将可观察集合用于 bing 地图图钉
我目前使用 C# 中的 MapLayer 在 WP7 Bing 地图上填充图钉。这没关系,但最近遇到了一些问题,包括地图控件中的错误导致了一些问题,所以我希望更改系统,在该系统中构建一个可观察的集合,该集合对图钉/位置等进行分类,然后绑定图钉位置使用 XAML 访问地图。与此类似: http ://beyondrelational.com/blogs/dinesh/archive/2010/06/26/bing-maps-binding-xml-data-source.aspx(不幸的是我无法开始工作。)
我的主要问题是,与其他集合相比,人们使用 ObservableCollection 是否有原因?
我将从提要中下载的 linq-to-xml 结果中对集合进行分类(以某种方式):-)
谢谢。
I currently populate pushpins on a WP7 Bing map using a MapLayer all in c#. This is ok, but have recently come across some issues including a bug in the map control causing some problems, so I am looking to change to the system where you build an observable collection which genreates the pushpins/locations etc, then bind the Pushpin locations to the map with XAML. Similar to this: http://beyondrelational.com/blogs/dinesh/archive/2010/06/26/bing-maps-binding-xml-data-source.aspx (which I cant quite get to work unfortunately.)
My main question is, Is there a reason people use ObservableCollection for this, as opposed to other collections?
I will be genreating the collection from linq-to-xml results downlaoded from a feed (somehow) :-)
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通常,ObservableCollection 用于绑定功能。当从 ObservableCollection 中添加/删除项目时,它们绑定到的 UI 元素将自动更新。
Generally ObservableCollection is employed for the binding functionality. When items are added/removed from an ObservableCollection, the UI element they are bound to will automatically update.