C# - 9 - How to implement PropertyChanged events.

[C# 2.0]

Suppose you have a class with one or more properties and you want to raise an event everytime a property changes. Here's how:

First add an INotifyPropertyChanged interface to the class declaration.

Next add some boilerplate …

Finally, add an invoke of OnPropertyChanged to each property (in their set accessor). For example:


Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License