wpf-devexpress-dot-xpf-dot-map-dot-mapcontrol-dot-zoomtofitlayeritems-x28-system-dot-boolean-x29.md
Zooms the map to fit items that map layers contain. 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
public void ZoomToFitLayerItems(
bool roundZoomLevel
)
Public Sub ZoomToFitLayerItems(
roundZoomLevel As Boolean
)
| Name | Type | Description |
|---|---|---|
| roundZoomLevel | Boolean |
Specifies whether to round the zoom level value.
|
The ZoomToFitLayerItems method works as follows:
Calculates a bounding box around map items contained in map layers.
Zooms the map to fit the box.
The following image shows a map with the padding factor parameter set to 0.3:
The following code snippet zooms a map to display items contained in all map layers:
using DevExpress.Map;
using DevExpress.Xpf.Map;
using System.Windows;
namespace MapApp {
public partial class MainWindow : Window {
private void OnWindowLoaded(object sender, RoutedEventArgs e) {
mapControl.ZoomToFitLayerItems(roundZoomLevel: true);
}
}
}
Imports DevExpress.Map
Imports DevExpress.Xpf.Map
Namespace MapApp
Public Partial Class MainWindow
Inherits Window
Private Sub OnWindowLoaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
mapControl.ZoomToFitLayerItems(roundZoomLevel:=True)
End Sub
End Class
End Namespace
See Also