将锚线添加到 Bing 地图自定义图钉并允许用户拖动

发布于 2024-10-21 00:28:37 字数 299 浏览 4 评论 0原文

我目前正在使用 Bing Map 控件开发 Silverlight 应用程序,我正在使用由网格元素内的图像和文本块组成的自定义图钉,效果很好,这也允许我拥有悬停和右键单击事件到目前为止,每个图钉都很好,但是我需要使用户能够向任何方向拖动图钉,并有一条线将其连接到其实际位置,有点像锚点。

我正在努力了解如何做到这一点,我已经看到了很多有关使图钉能够通过鼠标移动的信息,但线条和锚点部分给我带来了一些问题。目前,我将图钉保存在各种可观察集合中,以便当它们更新时 UI 也会更新。如果有人对添加此功能的干净方式有任何想法,请告诉我,我将不胜感激。

非常感谢

I am currently working on a Silverlight application using the Bing Map control, i am using a custom pushpin made up of an Image and a text block within a grid element, which works fine, this also allows me to have hover and right click events for each pushpin so all good so far, however there is a need for me to enable the user to drag the pushpin in any direction and have an a line connecting it to its actual position, sort of like an anchoring point.

I am struggling to see how to do this, I have seen lots of information on making the pushpins have the capability to be moved by the mouse but the line and anchor part is causing me a bit of a problem. Currently i keep my pushpins in various Observable Collections so that when they are updated the UI updates. If anyone has an Idea on a clean way of adding this functionality please let me know it will be much appreciated.

Many Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

沧笙踏歌 2024-10-28 00:28:37

我没有时间敲出一个完整的例子。不过,我将放弃解决方案的基础。将模板替换为基于 Canvas 的模板。例如,您可以将一个椭圆作为地图上的实际点,一个具有 ContentPresenter 的可拖动边框和一条充当系绳的线。

所需的代码是 a) 允许拖动边框,b) 移动线的一端,使其位于边框下方。

I haven't got time to knock up a complete example. However I'll give away the basis of the solution. Replace the template with one based on a Canvas. For example you could have an ellipse to be the actual point on the map, a draggable border that has the ContentPresenter and a line to act as a tether.

The code needed is a) allow the Border to be dragged about and b) to move one end of the line about so that it lies under the Border.

攒眉千度 2024-10-28 00:28:37

我仍然对其他方法感兴趣,但我提出了一种将图钉元素与 MapPolyline 配对的解决方案,这与鼠标处理相结合,允许用户拖动图钉更新两者,它非常有效,并且可以用于现在。不过,我仍然希望听到其他人提出更好的建议。

I am still interested in other approaches but I have come up with a solution of paring my pushpin element with a MapPolyline, this in conjunction with the mouse handling to allow the user to drag the pushpin updates both, it is pretty effective and will do for now. I would still like to hear from anyone else with better suggestions though.

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