如何知道第一次操作 Map 控件的时间? [英] how to know when Map control was first manipulated?

查看:24
本文介绍了如何知道第一次操作 Map 控件的时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Windows Phone 8 中使用地图控件.

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.

一些背景信息:我看到当显示控件时,它会自动将世界地图居中,并引发 CenterChanged 事件.我无法理解 ManipulationStarted、ManipulationDelta 和 ManipulationCompleted 是如何工作的.第一次拖动时,没有调用 ManipulationStarted,只有 ManipulationCompleted.

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.

我可以将用户的第一次操作视为第二次触发 CenterChanged.但这是一个黑客或猜测,我不高兴不能很好地理解它是如何工作的.

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.

推荐答案

Map 控件拦截并处理 Manipulation 事件,因此您无法获得所有这些事件.请记住,一旦路由事件被标记为 e.Handled=true,它们就不再冒泡.

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.

根据您的方案 WP8 公开 UseOptimizedManipulationRouting 属性可能证明是有用的.设置 UseOptimizedManipulationRouting=false 会导致 Map、Pivo​​t 和其他控件不吞下嵌套控件的事件.

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.

如果这没有帮助,请查看以下诺基亚 Wiki 文章,其中作者遇到了与您相同的问题,并使用 Touch.FrameReported 解决了@http://www.developer.nokia.com/Community/Wiki/Real-time_rotation_of_the_Windows_Phone_8_Map_Control

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

这篇关于如何知道第一次操作 Map 控件的时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆