Map - Prevent Panning Map off the screen

2 posts, 0 answers
  1. Jim
    Jim avatar
    6 posts
    Member since:
    Mar 2011

    Posted 24 Mar 2011 Link to this post

    When running the demo of the wpf controls and running the map example "First Look". Its possible to pan the map right off the screen.
    I have the same issue in my application and I need to stop this from happening.

    I see this was a previous issue under Issue ID 3713 - Map: Ability to limit panning and zoom ranges.
    This issue has the status of resolved but I don't see what the solution is.

    I figured out how to limit zoom ok by using MinZoomLevel and MaxZoomLevel but I see nothing for limiting panning.

    I still need a solution for panning?

    Please help.

  2. Andrey
    Andrey avatar
    1681 posts

    Posted 29 Mar 2011 Link to this post

    Hello Jim,

    You can use the GeoBounds property of RadMap for limiting panning. The sample following code restricts panning to whole world map:
    public partial class MainWindow : Window
        public MainWindow()

    var provider = new BingMapProvider(MapMode.Aerial, true, "My BingMap Key");
            this.radMap.InitializeCompleted += new EventHandler(radMap_InitializeCompleted);
            this.radMap.Provider = provider;

    private void radMap_InitializeCompleted(object sender, EventArgs e)
            this.radMap.GeoBounds = new LocationRect(new Location(this.radMap.SpatialReference.MinLatitude, this.radMap.SpatialReference.MinLongitude),
                new Location(this.radMap.SpatialReference.MaxLatitude, this.radMap.SpatialReference.MaxLongitude));

    All the best,
    Andrey Murzov
    the Telerik team
Back to Top