I’m using the brand new Windows Phone 8 Map control, but have run into an issue: I need to get the LocationRectangle of the map’s bounds, in other words the Latitude span and Longitude span.
With the Bing Maps control, you can just do:
LocationRect bounds = map.Bounds;
…however, there seems to be no relevant fields in this new control. Can anyone help, or do I need to reverse engineer the various Zoom Levels and work it out based on the center point, Zoom Level and pixel height/width ?
You can use the viewport convert methods, like:
Probably you can directly use the renderSize of the mapControl instance, but to be sure about the right dimensions on runtime, i would suggest to listen for the “SizeChanged” event. And checking the mapsize values not to be 0 or Infiniteis probably also a good idea.