I know MVVM heavily uses the INotifyPropertyChanged, but I have never seen any usage of the INotifyPropertyChanging. Any reason why?
If I did want to use this, what would be a good way to integrate this into my MVVM Framework? I know you’re not supposed to use MessageBox on your ViewModel because then you can’t unit test it. So how would one go about throwing up an alert, then continuing on with the PropertyChange if applicable?
Something to keep in mind about
INotifyPropertyChangingis you can’t stop the change from happening. This merely allows you to record that the change occurred.I use it in a framework of mine for change tracking, but it isn’t an appropriate method for halting changes.
You could extend your
ViewModelBasewith a custom interface/event pair:At this point you’d need to add it by convention to your view models: