×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Registered User
    Join Date
    Dec 2012
    Posts
    1

    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 Windows Phone 8 Maps Examples. Sources: http://projects.developer.nokia.com/...d29&format=zip

    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

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2012
    Location
    Bilbao
    Posts
    53

    Re: WP8: Map ViewChanged and ViewChanging events, extents

    Hi!

    The doc for the map control is very basic, but can be found in MSDN:
    http://msdn.microsoft.com/en-us/libr...v=vs.105).aspx

    Also i find This article in the Nokia blogs about maps:
    http://www.developer.nokia.com/Blogs...december-2012/


    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
    Last edited by josueyeray; 2012-12-22 at 09:50.

  3. #3
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    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.

  4. #4
    Registered User
    Join Date
    Jun 2013
    Location
    Munich
    Posts
    4

    Re: WP8: Map ViewChanged and ViewChanging events, extents

    Quote Originally Posted by symbianyucca View Post
    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.
    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 http://conversations.nokia.com/2013/...end-your-time/)
    Last edited by arein; 2013-06-04 at 19:39. Reason: Typo

  5. #5
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: WP8: Map ViewChanged and ViewChanging events, extents

    have you checked the CenterChanged event handler already ? The even't example shows some otehr event you could also get: https://projects.developer.nokia.com...inPage.xaml.cs

  6. #6
    Registered User
    Join Date
    Jun 2013
    Location
    Munich
    Posts
    4

    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

  7. #7
    Registered User
    Join Date
    Aug 2013
    Posts
    3

    Re: WP8: Map ViewChanged and ViewChanging events, extents

    Hi Nippuside,

    I'm struggling with the same first point that you mention above. Did you ever come to a solution?

    Thanks
    Mauro

  8. #8
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: WP8: Map ViewChanged and ViewChanging events, extents

    Quote Originally Posted by Mauro Da Silva View Post
    Hi Nippuside,

    I'm struggling with the same first point that you mention above. Did you ever come to a solution?

    Thanks
    Mauro
    Have you tried any of the things suggested ?
    And if you have, how are they not fixing the issue you are having ?

  9. #9
    Registered User
    Join Date
    Aug 2013
    Posts
    3

    Re: WP8: Map ViewChanged and ViewChanging events, extents

    Hi symbianyucca,

    I have managed to get a solution going using the ZoomLevelChanged and CenterChanged Events. However, these fire very often and cause the map to slow down extremely as the code is being executed way to often. I'm looking for something that only fires on the last zoom/centering, kind of like the old ViewChangeEnd was.

    Do you know of how I can achieve this/if there is something available?

    Thanks very much for your help.

    Regards,
    Mauro

  10. #10
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: WP8: Map ViewChanged and ViewChanging events, extents

    I would then try the ResolveCompleted, or you could maybe have a timer. Which you reset after each change, so if the changes are happening qiuck enough, the timer would never fire, since its being reset all the time. And once the changes stop (or are happening lowly enough), the timer would fire, and you could handle your logic in there.

  11. #11
    Registered User
    Join Date
    Aug 2013
    Posts
    3

    Re: WP8: Map ViewChanged and ViewChanging events, extents

    Cool, thanks very much for the reply. I tried the ResolveCompleted event and it seems that should do the job.

    Thanks so much again for your help.

    Regards,
    Mauro

Similar Threads

  1. Key events
    By sridharbandi in forum Symbian C++
    Replies: 6
    Last Post: 2010-07-05, 07:51
  2. key events
    By manzoor10 in forum Symbian C++
    Replies: 10
    Last Post: 2009-02-19, 14:49
  3. Replies: 2
    Last Post: 2009-01-21, 05:13
  4. high-level events VS. low-level events
    By zivgr in forum Mobile Java General
    Replies: 3
    Last Post: 2003-05-14, 16:13

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •