WPF:数据绑定中使用的集合的正确基类是什么? [英] WPF: What is the right base class for collections used in data binding?
本文介绍了WPF:数据绑定中使用的集合的正确基类是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用强类型的收集类(例如 CustomerCollection
)构建对象模型。我想支持集合本身和集合中所有数据模型的完全双向绑定。
I am building an object model with strongly typed collection classes (e.g. CustomerCollection
). I want to support full two-way binding on both the collection itself and all of the data models in the collection.
对于模型,它似乎实现 INotifyPropertyChanged
是连接模型的正确方法。但是我应该使用什么推论/基类,以便WPF知道我的集合内容是否改变?
For the models it seems like implementing INotifyPropertyChanged
is the right way to wire up the models. But what inferface/base class should I use so that WPF knows when my collection's contents change?
推荐答案
ObservableCollection< T>
- 专门设计用于WPF绑定。
ObservableCollection<T>
- designed specifically for WPF binding.
这篇关于WPF:数据绑定中使用的集合的正确基类是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文