绑定到元组列表
我有一个与两条数据配对的元组列表...我想将该列表绑定到数据网格。对于显示,它工作正常...但如果我尝试修改一个条目,它会显示“TwoWay 或 OneWayToSource 绑定无法在只读属性“Item1”上工作”...大概元组在 .NET 4.0 中是不可变的。有没有一种简单的方法可以绑定到数据对,而无需创建我自己的可变元组类?
I have a list of tuples pairing two pieces of data... I'd like to bind the list to a data grid. For display, it works fine... but if I try and modify an entry, it says "A TwoWay or OneWayToSource binding cannot work on the read-only property 'Item1'"... presumably Tuples are immutable in .NET 4.0. Is there an easy way to bind to pairs of data without creating a mutable tuple class of my own?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,元组是不可变的。匿名类型也是不可变的。您应该使用自己的泛型类型:
Yes, tuples are immutable. Anonymous types are also immutable. You should use your own generic type: