DependencyProperty

DependencyObject/DependencyProperty

陌路散爱 提交于 2021-01-13 00:38:58
DependencyProperty只能定义在DependencyObject对象中,WPF大多数基础类都是这个类的子类。比如UIElement.在WPF中定义的目标属性必须是依赖属性。 同时我们经常会更新座位源的底层数据,然后更新到界面,这是被绑源必须实现INotifyPropertyChanged接口。 当源数据更新时如果想更新界面需要触发PropertyChanged事件, WPF will subscribe to the PropertyChanged event when you bind to your object. This is the core way that databinding works. It actually does this via the PropertyChangedEventManager using the WeakEvent pattern in WPF. The INotifyPropertyChanged interface is used to notify clients, typically binding clients, which a property value has changed. The INotifyPropertyChanged interface contains an event called