This is a migrated thread and some comments may be shown as answers.

Undesired scrolling and zooming when setting geobounds

1 Answer 81 Views
Map
This is a migrated thread and some comments may be shown as answers.
David Ramos
Top achievements
Rank 1
David Ramos asked on 14 Jul 2016, 06:31 PM

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?

1 Answer, 1 is accepted

Sort by
0
Accepted
Dinko | Tech Support Engineer
Telerik team
answered on 19 Jul 2016, 11:54 AM
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.

Regards,
Dinko
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
Map
Asked by
David Ramos
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or