wpf-devexpress-dot-xpf-dot-map-dot-mapcontrol-dot-zoomtoregion-x28-devexpress-dot-map-dot-coordpoint-devexpress-dot-map-dot-coordpoint-system-dot-boolean-system-dot-double-x29.md
Zooms to the region by its top-left and bottom-right points, and specifies whether to apply an integer zoom level.
Namespace : DevExpress.Xpf.Map
Assembly : DevExpress.Xpf.Map.v25.2.dll
NuGet Package : DevExpress.Wpf.Map
public void ZoomToRegion(
CoordPoint p1,
CoordPoint p2,
bool roundZoomLevel,
double paddingFactor = 0.15
)
Public Sub ZoomToRegion(
p1 As CoordPoint,
p2 As CoordPoint,
roundZoomLevel As Boolean,
paddingFactor As Double = 0.15
)
| Name | Type | Description |
|---|---|---|
| p1 | CoordPoint |
The coordinate of the top-left region point.
| | p2 | CoordPoint |
The coordinate of the bottom-right region point.
| | roundZoomLevel | Boolean |
Specifies whether to round the zoom level value.
|
| Name | Type | Default | Description |
|---|---|---|---|
| paddingFactor | Double | 0.15 |
Specifies the size of the border around displayed map items.
|
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 code zooms the map in the specified region and applies an integer zoom level:
using DevExpress.Xpf.Map;
using System.Windows;
namespace MapApp {
public partial class MainWindow : Window {
private void OnWindowLoaded(object sender, RoutedEventArgs e) {
mapControl.ZoomToRegion(p1: new GeoPoint(51.30, 0.07), p2: new GeoPoint(41.54, 12.3), roundZoomLevel: true, paddingFactor: 0.15);
}
}
}
Imports DevExpress.Xpf.Map
Namespace MapApp
Public Partial Class MainWindow
Inherits Window
Private Sub OnWindowLoaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
mapControl.ZoomToRegion(p1:=New GeoPoint(51.30, 0.07), p2:=New GeoPoint(41.54, 12.3), roundZoomLevel:=True, paddingFactor:=0.15)
End Sub
End Class
End Namespace
See Also