The most common way is to implement the INotifyPropertyChanged Interface
The interface defines one single member:
event PropertyChangedEventHandler PropertyChanged
Used like this:
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
If you use .Net 4.5 you can make use of CallerMemberNameAttribute so you don't have to specify the name of the property manually (or by other means):
// This method is called by the Set accessor of each property.
// The CallerMemberName attribute that is applied to the optional propertyName
// parameter causes the property name of the caller to be substituted as an argument.
private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
The source of the above code is the documentation I linked to.
If you use .Net 4.0 or earlier, you can still use strongly typed property names instead of typing strings manually, but you need to implement a method like this, and then you can call it using expressions:
OnPropertyChanged(() => this.SomeProperty);