Map.ZoomLevel Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

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)

Syntax

Public Property ZoomLevel As Double
public double ZoomLevel { get; set; }

Property Value

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

Remarks

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

Version Information

Windows Phone OS

Supported in: 8.1, 8.0

See Also

Reference

Map Class

Microsoft.Phone.Maps.Controls Namespace

Other Resources

Maps and navigation for Windows Phone 8