/// <summary> /// This method is a helper method for raising the PropertyChanged event. /// </summary> /// <param name="name">The name of the property that was just changed.</param> /// <param name="oldValue">The value of the property before it was changed.</param> /// <param name="newValue">The value of the property after it was changed.</param> protected void RaisePropertyChangedEvent(string name, object oldValue, object newValue) { // Validate the specified property name this.ValidateProperty(name); // Create the event args UndoablePropertyChangedEventArgs eventArgs = new UndoablePropertyChangedEventArgs(this, name, oldValue, newValue); // Invoke the OnPropertyChanged method for derived classes this.OnPropertyChanged(eventArgs); // Raise the event for the INotifyPropertyChanged interface if (this.notifyPropertyChanged != null) { this.notifyPropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(name)); } // Raise the EditorFoundation based event which includes old/new values if (this.PropertyChanged != null) { this.PropertyChanged(this, eventArgs); } }
/// <summary> /// Called before the <see cref="E:PropertyChanged"/> event is raised. /// </summary> /// <remarks> /// Notes to Inheritors: When overriding OnPropertyChanged in a derived class, calling the base class's OnPropertyChanged method is not necessary because there is no initial implementation. /// </remarks> /// <param name="eventArgs">The <see cref="UndoablePropertyChangedEventArgs"/> instance containing the event data.</param> protected virtual void OnPropertyChanged(UndoablePropertyChangedEventArgs eventArgs) { }