我已经定义了以下观点:的Invalidate CollectionViewSource
<CollectionViewSource x:Key="PatientsView" Source="{Binding Source={x:Static Application.Current}, Path=Patients}"/>
如果病人是以下属性:
public IEnumerable<Patient> Patients
{
get
{
return from patient in Database.Patients
orderby patient.Lastname
select patient;
}
}
在我的代码
某处,我改变了患者数据库,我想有显示此数据的控件(使用“PatientsView”)将被自动通知。什么是正确的方法来做到这一点? CollectionViewSource可以失效或什么?
我的所有更改都是在应用程序的本地完成的,所以我可以添加刷新逻辑。但是,调用Refresh()不起作用! – 2009-05-12 14:09:22
我修改了我的帖子,提供了更多的想法。 – arconaut 2009-05-12 14:48:49
就是这样。仍然不知道为什么刷新()不起作用,但这工作正常!谢谢 – 2009-05-13 07:44:07