What is the importance of RaisePropertyChanged?

Read this:

http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.aspx

The RaisePropertyChanging event is used to notify UI or bound elements that the data has changed. For example a TextBox needs to receive a notification when the underlying data changes, so that it can update the text you see in the UI. Without the NotifyPropertyChanged event, the TextBox would have no idea that the data changed.

It's very important in MVVM.


The RaisePropertyChange are events which signal a change in status of the property to those who subscribe to the class. If you look at the base class in MVVM light you will find that it adheres to INotifyPropertyChanged.

When a property notifies a change a subscriber (most likely a binding in the Xaml), the consumer of the event knows to update the control with new data. That allows the view to be updated asynchronously without having to directly update any bound control(s).

See my answer to MVVM update of calculated properties for an example where updates can be pushed using the INotifyPropertyChange.

Also on my blog I discuss MVVM binding (which MVVM light simply is a wrapper for) Xaml: ViewModel Main Page Instantiation and Loading Strategy for Easier Binding. which may show you how its done without the MVVM light helper wrappers.


WPF binding mechanism relies on the DataContext of each FrameworkElement to Raise PropertyChanged event in order for it's Dependency Properties in that to sample the value of the plain CLR property they are bound to.

Dependency Property <- Binding -> Plain CLR Property

When loaded each of the FrameworkElement's Dependency Properties will be given the value from the bound CLR Property.

The Binding engine listens to the PropertyChanged event , When raised it locates the corresponding Dependency Property (Properties) bound the CLR Property which name is given in the event args , and updates their value from it ( at this point you would reach your CLR Property's getter ).