tags:

views:

150

answers:

1

I would like to understand how the MVVM light toolkit raises the PropertyChanged event.

I have a feeling that this may be obvious... but I can't satisfy my curiousity without 100% clarity!

I know that this event is raised for each RaisePropertyChanged called, but I'm confused as to why PropertyChanged is raised when the HasValidationErrors property is changed as well?

Thanks, Richard

A: 

When it comes to ViewModels or any class that implements INotifyPropertyChanged it is part of the contract that every property should raise the event when the property value changes. This way there is no unexpected behavior.

aqwert
I believe I understand this, but the event still needs to be subscribed to somewhere... I'm wondering how/where MVVM-Light subscribes to this event within it's base classes... I know I'm missing something here, and it's driving me crazy.
codputer
WPF takes care of this by itself. When you attach the VM to the View via DataContext it will check if it implements that interface and for any element that has DataBinding to a property will refresh the value when the event is raised for that property.
aqwert
That is what I was looking for - thanks!
codputer