I was wondering if anyone was trying to do something like this:
public bool SetMappedProperty<TC,TV>(ref TC cont, TV value, [CallerMemberName] string propertyName = null)
{
var prop = cont.GetType().GetProperty(propertyName);
var old = prop.GetValue(cont, null);
if (Equals(old, value)) { return false; }
prop.SetValue(cont, value);
RaisePropertyChanged(propertyName);
return true;
}
and used it like this:
public override MyType MyProperty
{
get { return _myData.MyProperty; }
set { SetMappedProperty( ref _myData, value); }
}
WhenanyValue-things reactive extensions can also help.
source
share