Skip to main content
All docs
V24.1

MapControl.ZoomToRegion(MapBounds, Double) Method

Zooms the map to the specified region.

Namespace: DevExpress.Xpf.Map

Assembly: DevExpress.Xpf.Map.v24.1.dll

NuGet Package: DevExpress.Wpf.Map

Declaration

public void ZoomToRegion(
    MapBounds bounds,
    double paddingFactor = 0.15
)

Parameters

Name Type Description
bounds MapBounds

The bounds that specify a map region to display.

Optional Parameters

Name Type Default Description
paddingFactor Double 0.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):

WpfMapControl_ZoomToFit_VerticalFitting

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

WpfMapControl_ZoomToFit_HorizontalFitting

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

The following code zooms a map into a specified region:

using DevExpress.Map;
using DevExpress.Xpf.Map;

private void OnWindowLoaded(object sender, RoutedEventArgs e) {
    mapControl.ZoomToRegion(bounds: new MapBounds(new GeoPoint(51.30, 0.07), new GeoPoint(41.54, 12.3)), paddingFactor: 0.15);
}
See Also