I have a usercontrol to edit some properties. Each time i close the edit mode of a single property, the usercontrol call the setter which emit the PropertyChangedEvent, independent the property has been changed.
Notice, i can't change the usercontrol.
Goal: Avoiding needless PropertyChangedEvent
Workaround: Changing the Setter:
public string foo
{
get { return _foo; }
set
{
if(_foo==value)
return;
_foo=value;
NotifyPropertyChanged();
}
But I have many properties. I refuse to change all properties in that way.
Question 1: Exists a better way than my workaround?
Question 2: If not: How can i avoid code duplicate in my properties?