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.v24.2.dll
NuGet Package: DevExpress.Wpf.Map
Declaration
Property Value
Type | Description |
---|---|
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
<dxm:MapControl x:Name="map">
...
</dxm:MapControl>
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;
}
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.
<dxm:MapControl x:Name="map"
ScrollArea="-11.877712, 44.568441, 4.030490, 36.219329"
CenterPoint="40.155242, -2.912869"
ZoomLevel="4.5">
...
</dxm:MapControl>