地图拖动事件 [英] Map dragged event

查看:86
本文介绍了地图拖动事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Windows Phone Silverlight中的Map控件。我想在用户拖动和平移地图时触发一个事件
然而我不希望在代码更改地图位置时触发事件。因此,CenterChanged事件本身不会起作用。

I'm using the Map control in Windows Phone silverlight. I want to fire an event when the user drags and pans the map around however I don't want the event to be fired when the map location is changed by the code. As a result the CenterChanged event won't work on its own.

基本上,我想要实现的是一个以您当前位置为中心的地图。这是由我连接的位置更改事件中的代码设置的。如果用户移动地图,虽然地图不应该重新定位自己20秒,所以我需要捕获
用户以某种方式与地图交互的事件。

Basically, what I'm trying to achieve is a map that stays centred on your current location. This is set by code in a location changed event I have hooked up. If the user moves the map though the map shouldn't recenter itself for 20 seconds so I need to capture an event that the user has interacted with the map in some way.

推荐答案

如果用户或以编程方式完成,事件将始终触发。但是,您可以通过使用鼠标/触摸向上和向下事件并使用布尔标志来区分,当您将鼠标/触摸在地图上向下时设置为true,并在向上甚至触发时将其设置为false
。然后,当CenterChanged事件触发时,您可以检查此标志。您可能需要根据首先发生的火灾,向上或中心变化事件来进行游戏。
The event will always fire if done by the user or programmatically. You can however tell the difference by using the mouse/touch up and down events and having a Boolean flag that you set to true when the mouse/touch is down on the map and set to false when the up even fires. You can then check this flag when the CenterChanged event fires. You might have to play around depending on which fires first, the up or the centerchanged event.


这篇关于地图拖动事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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