Bing Maps – Zoom to See Entire MapLayer in Bing Maps

bing-mapsmobilesilverlightwindows-phone

If I have a MapLayer that I'm applying to Bing Maps where I have a list of coordinates, how can I zoom to see the full MapLayer (dynamically zoom to the proper size) and toggle between seeing the starting point and ending point?

Best Answer

Use setView(LocationRect rect) in the Map to zoom. I would guess that MapLayer.GetPositionRectangle(layer) would give the full extent of the layer but I'm not sure. Otherwise loop through the list and create the LocationRect. For panning to different locations use the SetView(GeoCoordinate center, double zoomLevel) using the map ZoomLevel

Related Question