Is it poss开发者_StackOverflowible 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
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;
}
}
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.
精彩评论