C# RaisePropertyChanging?
c#, mvvm, wpf
Solution
Using `INotifyPropertyChanging` would allow consuming code a chance to consume the previous value of a property, before a change is applied. This is not frequently going to be useful, but there are cases where it might be: if you imagine a property that represents an "active object," this event would allow you to trigger code that would fire when the object is de-activated.
As a contrived example, consider a UI where the change in value of a field is required to display in a specific way: the old value should "float" off the screen leaving the new value behind. If a model class implemented `INotifyPropertyChanging`, a viewmodel class could attach to this event in order to cache the old value for use in the float animation. This allows the model class to represent the current state, while the viewmodel can maintain all values necessary to drive the UI.
Problem
I'm not sure why I should use RaisePropertyChanging, when notifying the view fx: ``` private LoggingLvl _myLoggingLvl; public LoggingLvl MyLoggingLvl { get { return _myLoggingLvl; } set { RaisePropertyChanging("MyLoggingLvl"); _myLoggingLvl = value; RaisePropertyChanged("MyLoggingLvl"); } } ``` why is it recommended to use `RaisePropertyChanging`?