Back to Devexpress

MapControl.ZoomToFitLayerItems(Boolean) Method

wpf-devexpress-dot-xpf-dot-map-dot-mapcontrol-dot-zoomtofitlayeritems-x28-system-dot-boolean-x29.md

latest2.4 KB
Original Source

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.v25.2.dll

NuGet Package : DevExpress.Wpf.Map

Declaration

csharp
public void ZoomToFitLayerItems(
    bool roundZoomLevel
)
vb
Public Sub ZoomToFitLayerItems(
    roundZoomLevel As Boolean
)

Parameters

NameTypeDescription
roundZoomLevelBoolean

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 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:

csharp
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);
        }
    }
}
vb
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

MapControl Class

MapControl Members

DevExpress.Xpf.Map Namespace