简体   繁体   English

WPF 事件属性已更改?

[英]WPF event property changed?

What interface must i implement to be able to create wpf event when some thing changes?当某些事情发生变化时,我必须实现什么接口才能创建 wpf 事件?

INotifyPropertyChanged. INotifyPropertyChanged。

It's in System.ComponentModel它在System.ComponentModel

A small trick when using this interface, when you implement it with an empty delegate you don't have to check if the event is null every time you raise it.使用此接口时的一个小技巧,当您使用空委托实现它时,您不必在每次引发事件时检查事件是否为 null。

public event PropertyChangedEventHandler PropertyChanged = delegate { };

WPF controls inherit DependencyObject class. WPF 控件继承 DependencyObject class。 See: MSDN参见: MSDN

For business entities, you could still implement INotifyPropertyChanged.对于业务实体,您仍然可以实现 INotifyPropertyChanged。

INotifyPropertyChanged . INotifyPropertyChanged Here is a " How To ".这是一个“如何”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM