Reputation: 5359
When we display a Map control on Windows Phone 8, and we display a MapRoute, is there any way to auto set the zoom level so the full route first?
Upvotes: 0
Views: 1070
Reputation: 41
To auto-zoom the map in c# with a list of coordinates (instead of a route), you can auto-generate a view by using the following:
//Adjust zoom
LocationRectangle lr =
LocationRectangle.CreateBoundingRectangle(myGeoCoordinate, incidentGeoCoordinate, [and more]);
myMap.SetView(lr);
Upvotes: 4
Reputation: 1794
If you have "Route" instead of "MapRoute", you can use "BoundingBox".
yourMapControl.SetView(route.BoundingBox)
Upvotes: 3
Reputation: 65564
There's no way to say "zoom to include points A,B & X,Y" but if you know these you could calculate the distance between them and the center point between those outlying points and then center on that point and then set a zoom level which will include the whole area.
Upvotes: 1