WPF绑定到EntitySet? [英] WPF Binding to an EntitySet?

查看:79
本文介绍了WPF绑定到EntitySet?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

EntitySet是一个未实现INotifyCollectionChanged的密封类。在绑定到对象中包含的EntitySet时,是否有一种简单的方法可以向WPF添加/删除通知?

EntitySet is a sealed class that doesn't implement INotifyCollectionChanged.  Is there an easy way to get add/remove notifications to WPF when binding to an EntitySet contained inside an object?

我的绑定如下:

ItemsSource =" {Binding Source = {StaticResource PageData},Path = questions,Mode = TwoWay}"

ItemsSource="{Binding Source={StaticResource PageData}, Path=questions, Mode=TwoWay}"

其中"问题" ;是实体集的路径。

where "questions" is the path to an EntitySet.

感谢任何指针。

Thanks for any pointers.

推荐答案

您需要将EntitySet包装在您自己的Wrapper类中,该类捕获EnitySet更改并将它们转换为INotifyCollectionChanged

在设置ItemsSource属性之前应用包装器
br> control.ItemsSource = new

示例:


you need to wrap the EntitySet in your own Wrapper class that catches the EnitySet Changes and translates them to INotifyCollectionChanged

Apply the wrapper just before you set the ItemsSource property

control.ItemsSource = new

Example:




Code Snippet


这篇关于WPF绑定到EntitySet?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆