public static perRelayCommandAsync ObservesExternalProperty(this perRelayCommandAsync command, INotifyPropertyChanged source, string propertyName) { perWeakPropertyChangedEventHandler.Register(source, propertyName, command, (listener, sender, args) => listener.RaiseCanExecuteChanged()); return(command); }
public static perRelayCommandAsync ObservesInternalProperty(this perRelayCommandAsync command, INotifyPropertyChanged source, string propertyName) { source.PropertyChanged += (s, e) => { if (string.Equals(e.PropertyName, propertyName, StringComparison.InvariantCultureIgnoreCase)) { command.RaiseCanExecuteChanged(); } }; return(command); }
public static perRelayCommandAsync ObservesCollection(this perRelayCommandAsync command, INotifyCollectionChanged collection) { collection.CollectionChanged += (s, e) => command.RaiseCanExecuteChanged(); return(command); }