PropertyChanged not used correctly?

Oct 6, 2011 at 8:36 AM
Edited Oct 6, 2011 at 8:40 AM

first, let me explain my scenario:
  I want to implement undo/redo feature in my project. I need to be notified when user commits change in PropertyEditor (propertyeditor sets a value).

I tried to listen to PropertyEditor.PropertyChanged event. But this event is fired also when I change myInstance's property by myself.

INotifyPropertyChanged myInstance = new MyClass();
propertyEditor.SelectedObject = myInstance;
propertyEditor.PropertyChanged += (o, e) =>
{
...
};
myInstance.MyProperty = "some value"; //fires propertyEditor.PropertyChanged event

 

You should not fire  PropertyEditor.PropertyChanged event when SelectedObject.PropertyChanged event occurs,

or you should add another event to PropertyEditor which is fired only when PropertyViewModel.SetValue is called.

 or you can add extra flag to PropertyValueChangedEventArgs

 

 

Coordinator
Oct 6, 2011 at 11:31 AM

hi Liero, can you try to rebuild PropertyTools from the latest changeset. I think this error was corrected in change set 70899. Let us know if it is still a problem with your code, and we should have it fixed!