纬度/经度数据绑定转换器(多个参数)
我正在使用 Web 服务接收对象列表,然后将其直接将数据绑定到图钉。然而,该对象具有纬度和经度坐标(因此具有单独的属性)。虽然我显然可以将地理坐标位置属性添加到自动生成的代码中,但我宁愿不这样做(因为它是自动生成的)
因此,当数据绑定到图钉时,它需要一个位置,但我不知道如何将其绑定到两个单独的项目。所以我想也许转换器可以接受 2 个项目并返回一个位置,但我不认为转换器可以接受这样的 2 个值?
MultiBinding 看起来像是解决方案,但不幸的是 Silverlight 中似乎不存在,因此看起来需要采用不同的方法
那么,有没有一种方法可以像这样绑定?
谢谢
I am using Web Services to receive a list of objects which I have then directly data bound to pushpins. However the object has coordinates as a latitude and longitude (so separate properties). Whilst I can obviously add a Geocoordinate Location property to the auto-generated code I would rather not (as it is auto-generated)
So when data binding to the pushpin it wants a location but I don't know how you can bind it to two separate items. So I thought maybe a converter could take the 2 items and return a location but I don't think a converter can take 2 values like this?
MultiBinding looked like the solution but doesn't seem to exist in Silverlight unfortunately so looks like a different approach is necessary
So, is there a way to bind like this?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
创建一个临时对象,将两个值存储为属性并将其传递给转换器。不支持多重绑定,但有几种方法可以解决这个问题。这是一种方法
Make an temporary object that stores the two values as properties and pass this to the converter. Multibinding is not supported, but there are a couple ways around that. This is one way