WP8: Map ViewChanged and ViewChanging events, extents
Hi,
I'm trying to migrate from Bing WP7 map to WP8 map.
1) Microsoft.Phone.Maps.Controls.Map exposes ViewChanging and ViewChanged events. I'd expect them to fire when I pan the map. That does not happen.
WP7 Bing map fires ViewChangeStart and ViewChangeEnd, ONCE per each view manipulation. My application hooks to latter and then draws content on the map. How would I implement this with WP8 map?
You can test WP8 events with MapEvents sample which is included in [URL="http://projects.developer.nokia.com/WP8MapsExamples/browser"]Windows Phone 8 Maps Examples[/URL]. Sources: [URL="http://projects.developer.nokia.com/WP8MapsExamples/export/archive?rev=a91494108636401414c54cebb2197c9b2fb72d29&format=zip"]http://projects.developer.nokia.com/WP8MapsExamples/export/archive?rev=a91494108636401414c54cebb2197c9b2fb72d29&format=zip[/URL]
2) How do you access map bounding rectangle (extents)?
WP7 Bing Map provides BoundingRectangle property which allows accessing map WGS84 bounds. I need that information for fetching content to be drawn on the map.
3) About CenterChanged and ZoomLevelChanged events: Why don't event arguments contain any data related to event (i.e. resulting center / zoom level)?
I asked these questions on Microsoft Dev Forum. They told me to continue here as "The new map system was supplied by Nokia".
Thanks,
Nippuside
Re: WP8: Map ViewChanged and ViewChanging events, extents
Hi!
The doc for the map control is very basic, but can be found in MSDN:
[url]http://msdn.microsoft.com/en-us/library/windowsphone/develop/microsoft.phone.maps.controls.map(v=vs.105).aspx[/url]
Also i find This article in the Nokia blogs about maps:
[url]http://www.developer.nokia.com/Blogs/Community/2012/12/03/windows-phone-8-maps-examples-featured-project-of-the-month-december-2012/[/url]
You now have two events: ViewChanging and ViewChanged, i think you can subscribe to ViewChanged that its mean to be fired once the manipulation of the view ends.
As for the bounding rectangle i don't see any property or method that resolves it.
Better you can take a look at the MSDN doc and try with the events and properties documented.
Good luck and sorry to can't help you more :(
Re: WP8: Map ViewChanged and ViewChanging events, extents
1) if you want to know when the map is fully drawn etc, for each differenc change, you could use ResolveCompleted, if that would not work, then please explain when and for what excatly you would need to get notified for.
2) what do you mean ? basically you can resolve the upperleft corder by checking what coordinate is gived for TPoint(0,0), and use TPoint(Width, height) to get the lower bottom, and these two points do give you are visible map boundaries.
3) I don't know the reasoning, anyway, as you know what has been changed, its rather easy to get the values from the map object.
Re: WP8: Map ViewChanged and ViewChanging events, extents
[QUOTE=symbianyucca;908485]1) if you want to know when the map is fully drawn etc, for each differenc change, you could use ResolveCompleted, if that would not work, then please explain when and for what excatly you would need to get notified for.
2) what do you mean ? basically you can resolve the upperleft corder by checking what coordinate is gived for TPoint(0,0), and use TPoint(Width, height) to get the lower bottom, and these two points do give you are visible map boundaries.
3) I don't know the reasoning, anyway, as you know what has been changed, its rather easy to get the values from the map object.[/QUOTE]
Dear Symbianyucca,
I found the ResolveCompleted method very handy to use. However, I noticed that it does not fire when the phone has no internet connection. While this is semantically correct, it is very unfortunate in my case. I was looking for an event that calls when the map is not moving anymore and also the user is not manipulating it anymore.
Could you think of a way to do that?
Regards,
Derek
(Developer of Track My Life [url]http://conversations.nokia.com/2013/05/16/track-my-life-discover-where-you-spend-your-time/[/url])
Re: WP8: Map ViewChanged and ViewChanging events, extents
have you checked the [B]CenterChanged[/B] event handler already ? The even't example shows some otehr event you could also get: [url]https://projects.developer.nokia.com/WP8MapsExamples/browser/wp8mapsexamples/MapEvents/MapEvents/MainPage.xaml.cs[/url]
Re: WP8: Map ViewChanged and ViewChanging events, extents
Hey Symbianyucca,
thanks for getting back!
I managed to get similar functionality by using CenterChanged and ZoomLevelChanged.
Regards,
Derek