具有可绑定数量的 MapItemsControl 的 Silverlight Bing Map

发布于 2024-12-27 07:42:32 字数 112 浏览 1 评论 0原文

是否可以将类似 ItemsSource 的内容添加到 Bing Map 控件以将 MapItemsControls 绑定到 ObservableCollection?实际上我想轻松地在地图上放置不同的图钉样式。

Is it possible to add something like ItemsSource to the Bing Map control to bind the MapItemsControls to a ObservableCollection? Actually I want to put different pushpin-styles on a map easily.

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

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

发布评论

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

评论(2

岁月无声 2025-01-03 07:42:32

如果我理解您的问题,您希望将 MapItemControls 集合添加到地图中 - 并且该集合必须是可绑定的 - 动态创建?

我之前也遇到过类似的问题。我的解决方案是创建一个新的 MapLayer 并将项目的二维集合公开为 DependencyProperty。

这是建议的方法:

public class SpecialLayer : MapLayer
{
    public static readonly DependencyProperty ItemsSource ... 
    OnPropertyChanged(...) 
    {
        var layer = sender as SpecialLayer;
        foreach(Object in Routes){
            layer.Add(new Pushpin(...));
        }
    }
}

我写了一篇 简短的帖子关于它。您可以检查它以获取一些详细信息。

洪扎

If I understand your question, you would like to have a collection of MapItemControls added to a map - and this collection has to be bind-able - created dynamically?

I had a similar issue before. The solution for me was to create a new MapLayer and expose two-dimensional collection of items as DependencyProperty.

Here is a suggested approach:

public class SpecialLayer : MapLayer
{
    public static readonly DependencyProperty ItemsSource ... 
    OnPropertyChanged(...) 
    {
        var layer = sender as SpecialLayer;
        foreach(Object in Routes){
            layer.Add(new Pushpin(...));
        }
    }
}

I wrote a short post about it. You can check it to get some details.

Honza

羁绊已千年 2025-01-03 07:42:32

是的,您可以通过图层做到这一点以及几乎任何您想要的东西。

官方网站上有各种示例:
http://www.microsoft.com/maps/isdk/silverlight/

Yes, you can do that and pretty much anything you want with layers.

There is all kind of examples available on official site:
http://www.microsoft.com/maps/isdk/silverlight/

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