private static void ChangeNotificationForDependentProperties(MethodInfo methodInfo, IAutoNotifyPropertyChanged model) { if (NoAdditionalProperties(methodInfo)) { return; } IEnumerable <string> properties = GetAdditionalPropertiesToNotifyOfChanges(methodInfo); foreach (string propertyName in properties) { model.OnPropertyChanged(propertyName); } }
public static bool SetProperty <T>(IAutoNotifyPropertyChanged owner, ref T storage, T value, string[] dependentPropertyNames = null, [CallerMemberName] string propertyName = null) { if (Equals(storage, value)) { return(false); } storage = value; owner.RaisePropertyChanged(propertyName); if (dependentPropertyNames != null) { foreach (var dependentPropertyName in dependentPropertyNames) { owner.RaisePropertyChanged(dependentPropertyName); } } return(true); }
/// <summary> /// Bind the <see cref="INotifyPropertyChanged.PropertyChanged"/> handler to automatically call each class's <see cref="IAutoNotifyPropertyChanged.Autonotify"/> method on the property name. /// </summary> /// <param name="entity">the entity to bind the autospecify event to</param> public static void Autonotify(this IAutoNotifyPropertyChanged entity) { entity.PropertyChanged += (me, e) => ((IAutoNotifyPropertyChanged)me).WhenPropertyChanges(e.PropertyName); }