Map.ZoomLevel Property

July 28, 2014

Gets or sets the zoom level of the Map, which is a value between 1 and 20.

Namespace:  Microsoft.Phone.Maps.Controls
Assembly:  Microsoft.Phone.Maps (in Microsoft.Phone.Maps.dll)

public double ZoomLevel { get; set; }

Property Value

Type: System.Double
The zoom level of the Map, which is a value between 1 and 20.

The ZoomLevel property takes a value from 1 to 20, where 1 corresponds to a fully zoomed out map, and higher zoom levels zoom in at a higher resolution.

During initialization of the Map control, the ZoomLevelChanged event is raised one time after the initialization. If your app handles the ZoomLevelChanged event, make sure that you handle this event correctly when it’s raised after initialization of the control.

The following code examples show how you can set the zoom level of the map by using the ZoomLevel property in XAML and code.


<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
   <maps:Map x:Name="MyMap" Center="47.6097, -122.3331" ZoomLevel="10"/>
</Grid>


public MainPage()
{
   InitializeComponent();
   Map MyMap = new Map();

   //Set the Map center by using Center property
   MyMap.Center = new GeoCoordinate(47.6097, -122.3331);

   //Set the map zoom by using ZoomLevel property
   MyMap.ZoomLevel = 10;
   ContentPanel.Children.Add(MyMap);
}

Windows Phone OS

Supported in: 8.1, 8.0

Show:
© 2014 Microsoft