Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1531
Programmatically setting map center and zoom level
posted

I'm using BingMapsImagery (I have a key), and I can get the map to load fine following the samples in the "Samples Browser".

However, I’m having trouble programmatically setting the map center and zoom levels.  For instance, I know that the Geographic center of the United States is latitude=39.833 and longitude=-98.583.  When the map is first displayed, I want that location to be the center of the map and I want to set a zoom level showing the entire United States.

I also want to add navigational controls allowing the user to quickly navigate to a specific location (again displayed at the center of the map) with some appropriate level of zoom.  For example, if the user selects “Houston, Texas”, then Houston, Texas would be displayed at the center of the map and the zoom level would be appropriate to see Houston and the surrounding area.  I have the geographical coordinates for all locations that I want to display in this manner, and I’ll also know generally how much zoom I need for each location.

My question is how do I configure the XamGeographicMap control to have a specific geographic location (latitude, longitude) as the center with the pre-defined level of zoom?  Other controls I’ve seen implement this fairly intuitively by simply setting the center latitude/longitude and a ZoomLevel property, but I don’t see anything like that with the XamGeographicMap control.

Thanks, Steve