Windows Phone 7 地图控制:平移地图,同时保持图钉不变

发布于 2024-12-07 06:00:41 字数 168 浏览 3 评论 0原文

我正在开发一款 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

暗恋未遂 2024-12-14 06:00:41

不要向图钉添加位置。相反,只需将其 Margin 设置为您想要的值即可。边距是从地图控件的绝对中心计算的,

这样它将位于固定位置。或者,您可以将地图添加到画布上,然后在画布上绘制任何元素。

但为什么要这么做,我实在是无法想象。

通常,图钉根据地理位置(GPS 坐标)固定,并在您平移/拖动/缩放地图时停留在该固定点。这就是 Pushpin.Location 属性的用途。

Don't add a Location to the Pushpin. Instead just set it's Margin to the values you want. The margins are calculated from the absolute center of the Map control

That 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文