Back to Devexpress

MapControl.ScrollArea Property

wpf-devexpress-dot-xpf-dot-map-dot-mapcontrol-2c629c5e.md

latest2.9 KB
Original Source

MapControl.ScrollArea Property

Gets or sets a rectangular area (also called scroll area) that confines the map center point.

Namespace : DevExpress.Xpf.Map

Assembly : DevExpress.Xpf.Map.v25.2.dll

NuGet Package : DevExpress.Wpf.Map

Declaration

csharp
public MapBounds ScrollArea { get; set; }
vb
Public Property ScrollArea As MapBounds

Property Value

TypeDescription
MapBounds

The scroll area boundaries.

|

Remarks

Use this property to limit scroll operations so that the map center point remains within the boundaries. To define these boundaries, specify the coordinates of the area’s top-left and bottom-right corners.

In the following animation, a rectangle depicts the scroll area boundaries and a dot indicates the map center position:

Example

This example specifies a rectangular area that confines the map center point:

In Code

xaml
<dxm:MapControl x:Name="map">
   ...
</dxm:MapControl>
csharp
using DevExpress.Xpf.Map;
//...
  private void Window_Loaded(object sender, RoutedEventArgs e) {
      map.ScrollArea = new DevExpress.Map.MapBounds(
                              new GeoPoint(44.568441, -11.877712),
                              new GeoPoint(36.219329, 4.030490));
      map.CenterPoint = new GeoPoint(40.155242, -2.912869);
      map.ZoomLevel = 4.5;
  }
vb
Imports DevExpress.Xpf.Map
'...
Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
    map.ScrollArea = New DevExpress.Map.MapBounds(New GeoPoint(44.568441, -11.877712), New GeoPoint(36.219329, 4.030490))
    map.CenterPoint = New GeoPoint(40.155242, -2.912869)
    map.ZoomLevel = 4.5
End Sub

In Markup

You can also specify the scroll area in markup. Coordinates are written in the following order: x1, y1, x2, y2, where x1, y1 are the top-left point’s coordinates, and x2, y2 are the bottom-right point’s coordinates.

xaml
<dxm:MapControl x:Name="map"
                ScrollArea="-11.877712, 44.568441, 4.030490, 36.219329"
                CenterPoint="40.155242, -2.912869" 
                ZoomLevel="4.5">
    ...
</dxm:MapControl>

See Also

MapControl Class

MapControl Members

DevExpress.Xpf.Map Namespace