问题
I am using the Map control in Windows Phone 8.
I need to implement a page where user can select his location using the map control. I am trying to know when the app was first manipulated by the user.
Some background info: I saw that when the control is shown, it automatically centers the world map, and CenterChanged event is raised. I am not able to understand how ManipulationStarted, ManipulationDelta and ManipulationCompleted work. the first time I drag, ManipulationStarted is not called, only ManipulationCompleted.
I could consider the first manipulation by user as being the 2nd time the CenterChanged is fired. But this is a hack or a guess, I am not happy not having a good understanding how it works.
回答1:
The Map control intercepts and handles Manipulation events and as such you don't get all of them. Remember, once routed events are marked at e.Handled=true they no longer bubble up.
Depending on your Scenario WP8 exposes the UseOptimizedManipulationRouting property which might prove useful. Setting UseOptimizedManipulationRouting=false causes Map, Pivot and other controls to not swallow events for nested controls.
If that doesn't help, have a look at the following Nokia Wiki article where the author ran into the same problem as you did and used Touch.FrameReported to get out of it @ http://www.developer.nokia.com/Community/Wiki/Real-time_rotation_of_the_Windows_Phone_8_Map_Control
来源:https://stackoverflow.com/questions/14389426/how-to-know-when-map-control-was-first-manipulated