开发者

Set zoom limit in bing maps for windows phone

开发者 https://www.devze.com 2023-02-13 01:42 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消