Back to Devexpress

MapControl.ZoomToRegion(MapBounds, Boolean, Double) Method

wpf-devexpress-dot-xpf-dot-map-dot-mapcontrol-dot-zoomtoregion-x28-devexpress-dot-map-dot-mapbounds-system-dot-boolean-system-dot-double-x29.md

latest2.9 KB
Original Source

MapControl.ZoomToRegion(MapBounds, Boolean, Double) Method

Zooms the map to the specified region. Allows you to specify whether to use an integer zoom level.

Namespace : DevExpress.Xpf.Map

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

NuGet Package : DevExpress.Wpf.Map

Declaration

csharp
public void ZoomToRegion(
    MapBounds bounds,
    bool roundZoomLevel,
    double paddingFactor = 0.15
)
vb
Public Sub ZoomToRegion(
    bounds As MapBounds,
    roundZoomLevel As Boolean,
    paddingFactor As Double = 0.15
)

Parameters

NameTypeDescription
boundsMapBounds

The bounds that specify a map region to display.

| | roundZoomLevel | Boolean |

Specifies whether to round the zoom level value.

|

Optional Parameters

NameTypeDefaultDescription
paddingFactorDouble0.15

Specifies the size of the border around displayed map items.

|

Remarks

The padding factor is applied to the larger dimension of the bounding box that contains visible items.

The following image shows an instance of a horizontal dimension that is larger than the vertical (“PF” means “Padding Factor” on images):

When the vertical dimension is larger than the horizontal, the zoom appears as follows:

Note that the padding factor is divided by two for each side of the region.

The following example zooms a map into a region, and applies an integer zoom level value:

csharp
private void OnWindowLoaded(object sender, RoutedEventArgs e) {
    mapControl.ZoomToRegion(bounds: new MapBounds(new GeoPoint(51.30, 0.07), new GeoPoint(41.54, 12.3)), roundZoomLevel: true, paddingFactor: 0.15);
}
vb
Private Sub OnWindowLoaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
    mapControl.ZoomToRegion(bounds:=New MapBounds(New GeoPoint(51.30, 0.07), New GeoPoint(41.54, 12.3)), roundZoomLevel:=True, paddingFactor:=0.15)
End Sub

See Also

MapControl Class

MapControl Members

DevExpress.Xpf.Map Namespace