I question the logic of raising a PropertyChanged
event on the second property when it's the first property that's changing. If the second properties value changes then the PropertyChanged
event could be raised there.
At any rate, the answer to your question is you should implement INotifyPropertyChange
. This interface contains the PropertyChanged
event. Implementing INotifyPropertyChanged
lets other code know that the class has the PropertyChanged
event, so that code can hook up a handler. After implementing INotifyPropertyChange
, the code that goes in the if statement of your OnPropertyChanged
is:
if (PropertyChanged != null)
PropertyChanged(new PropertyChangedEventArgs("MySecondProperty"));