Windows Phone 7 地图控制:平移地图,同时保持图钉不变
我正在开发一款 WP7(芒果)应用程序,该应用程序有一个 Bing 地图控件,屏幕上有一个图钉。我需要能够拖动/平移地图,以便地图视图发生变化,同时图钉相对于屏幕保持在恒定位置。我怎样才能实现这个目标?图钉似乎总是附着在地图上并随地图移动。
(这基本上是围绕地图拖动图钉的替代方法,即围绕图钉拖动地图)。
I'm working on a WP7 (mango) app which has a Bing Maps control with one pushpins on the screen. I need to be able to drag/pan the map so that the map view changes while the pushpin remains in a constant position relative on the screen. How can I achieve this? The pin always seems to be attached to the map and moves with the map.
(This is basically an alternative to dragging the pushpin around the map i.e. dragging the map around the pushpin).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不要向图钉添加
位置
。相反,只需将其Margin
设置为您想要的值即可。边距是从地图控件的绝对中心计算的,这样它将位于固定位置。或者,您可以将地图添加到画布上,然后在画布上绘制任何元素。
但为什么要这么做,我实在是无法想象。
通常,图钉根据地理位置(GPS 坐标)固定,并在您平移/拖动/缩放地图时停留在该固定点。这就是
Pushpin.Location
属性的用途。Don't add a
Location
to the Pushpin. Instead just set it'sMargin
to the values you want. The margins are calculated from the absolute center of the Map controlThat way it'll be in a fixed position. Alternatively, you can add the map on a Canvas, and just draw any element on top of the Canvas.
But why you want to do this, I really cannot imagine.
Normally a Pushpin is fixed according to a GeoLocation (a GPS coordinate), and stays at that fixed point, when you pan/drag/zoom the map. That's what the
Pushpin.Location
property/attribute is for.