About Bing Maps API in silverlight, how to disable the recursive?

Answered About Bing Maps API in silverlight, how to disable the recursive?

  • Wednesday, April 25, 2012 6:04 AM
     
     

    Hi All,

    I'm using the Bing Maps API in my silverlight project.

    Now, I have a question: Is it possible to disable the recursive?

    I mean, when the zoom level is low, I can see there are more than one 'Asia','Europe' on my map.

    In my project, I added many pushpins on my map to see a distribution.

    But you know, if there are 2 Asia, that is really confused in some time.

    So I wonder if there is a solution to disable the recursive of my map, or maybe just set a minZoomLevel to make sure that there will never be 2 'Asia' on my map?

    Thanks!

All Replies

  • Wednesday, April 25, 2012 8:39 AM
    Moderator
     
     Answered Has Code

    You can't disable the wraparound panning as such, but you can create your own map mode that limits the allowed zoom range and/or extents to which users can navigate. Something like this: (untested)

    public class LimitMapMode : Microsoft.Maps.MapControl.Core.MercatorMode
    {
        // Set min. zoom level to 5
        public Range<double> MapZoomRange = new Range<double>(5.0, 19.0);
    
        // Override GetZoomRange method to return allowed zoom range at given location
        protected override Range<double> GetZoomRange(Location center)
        {
            return this.MapZoomRange;
        }
    }
    


    twitter: @alastaira blog: http://alastaira.wordpress.com/

    • Marked As Answer by jnervo Wednesday, April 25, 2012 10:12 AM
    •  
  • Wednesday, April 25, 2012 10:15 AM
     
     

    Hi  tanoshimi,

    This is helpful. Thanks a lot.