Reputation: 661
Is it possible to limit max zoom of my map ? I'm using SetView to fit the map for a list of pushpins; if i have only one pushpin, map is zooming to 21. It's way to much, I would like to limit it to 15, for example. Thanks
Upvotes: 3
Views: 1768
Reputation: 2370
You can manually set ZoomLevel
after SetView
call:
myMap.SetView(LocationRect.CreateLocationRect(coordinates));
myMap.ZoomLevel = Math.Min(StopsMap.TargetZoomLevel, 15);
Please pay attention to TargetZoomLevel
property.
Upvotes: 0
Reputation: 16826
There is currently no single property that set the maximum zoom level. However, you can use the MapZoom event handler and check against the maximum ZoomLevel - if it is off the limits, prevent from further handling.
private void map1_MapZoom(object sender, Microsoft.Phone.Controls.Maps.MapZoomEventArgs e)
{
if (((Map)sender).ZoomLevel > 3)
{
e.Handled = true;
}
}
Upvotes: 1