Undesired scrolling and zooming when setting geobounds

2 posts, 1 answers
  1. David Ramos
    David Ramos avatar
    2 posts
    Member since:
    May 2008

    Posted 14 Jul Link to this post

    Is there a way to initialize a map to a specific position without having to see the map rapidly pan and zoom?

    I have a set of items in a VisualizationLayer and I would like to display those items on the map without scrolling and zooming. The layer is bound to a list in the xaml.

    Currently, I set the bounds by calling GetBestView() on the VisualizationLayer to get the precise boundaries. This works, but the map starts at coordinates 0,0 and then scrolls and zooms. It does this for several seconds - the appearance is very annoying to the user. 

    I would like to be able to set the bounds directly and have the map go straight to the area without scrolling and zooming. It may be that I am not setting the bounds at the appropriate time?

    Is this even possible?

  2. Answer
    Dinko avatar
    183 posts

    Posted 19 Jul Link to this post

    Hello David Ramos,

    You can disable the scrolling and the zooming by setting the UseSpringAnimations property of the map to false. As you want only to disable them when you are using the GetBestView() method you can preserve the current value of the UseSpringAnimations then set it to false and restore it after you have set the location rectangle which represents the best view.
        bool cachedUseSpringsAnimations = this.myMap.UseSpringAnimations;
        this.myMap.UseSpringAnimations = false;
        // Your code
        this.myMap.UseSpringAnimations = cachedUseSpringsAnimations;

    Give this approach a try and let us know if it works for you.

    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. DevCraft R3 2016 release webinar banner
Back to Top