“Regular” properties are not notifying the View

Jun 10, 2011 at 4:15 PM
Edited Jun 10, 2011 at 4:15 PM


I really appreciate the WPF Undo/Redo Framework. Thank you for sharing it. I plan to make use of it and maintain the LICENSE file, etc.

I have implemented Undo/Redo in my solution. It works fine in simple cases.  I am still testing.

I have a question:

In your example you override the PropertyChangedEventHandler.

event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged


    add { this._context.PropertyChanged += value; }

    remove { this._context.PropertyChanged -= value; }


This seems to be messing up my other “Regular” properties. They are not notifying the View. It even broke the Binding Fallback feature. My “Regular” properties have completely ceased functioning.

This is from my ViewModelBase class:

public virtual event PropertyChangedEventHandler PropertyChanged;

protected virtual void OnPropertyChanged(string propertyName)


    PropertyChangedEventHandler handler = this.PropertyChanged;
    if (handler != null)
     var e = new PropertyChangedEventArgs(propertyName);
     handler(this, e);

I don’t understand what the “add” and “remove” do. Have I misunderstood your intention?

Thanks for any help you can give.



Jun 16, 2011 at 2:02 AM

what the add and remove do is delegate all INotifyPropertyChanged subscriptions and unsubscriptions to the underlying context. This allows the context to let the view know when any undoable properties associated with that context change. One option is you can add a method to UndoRedoContext (by subclassing or simple modification) that allows you to raise property change notifications by doing something like _context.RaisePropertyChanged("sada"); that should make your properties work again...

Unfortunately, you cant just change var handler = this.PropertyChanged to var handler = this._context.PropertyChanged, because of c#'s rules on event raising.