MapControl.ZoomToFitLayerItems(Boolean) Method
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.v24.1.dll
NuGet Package: DevExpress.Wpf.Map
Declaration
Parameters
Name | Type | Description |
---|---|---|
roundZoomLevel | Boolean | Specifies whether to round the zoom level value. |
Remarks
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 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 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);
}
}
}