/// <summary> /// Observes a property that implements INotifyPropertyChanged, and automatically calls DelegateCommandBase.RaiseCanExecuteChanged on property changed notifications. /// </summary> /// <typeparam name="T">The object type containing the property specified in the expression.</typeparam> /// <param name="propertyExpression">The property expression. Example: ObservesProperty(() => PropertyName).</param> /// <returns>The current instance of DelegateCommand</returns> protected internal void ObservesPropertyInternal <T>(Expression <Func <T> > propertyExpression) { AddPropertyToObserve(PropertySupport.ExtractPropertyName(propertyExpression)); HookInpc(propertyExpression.Body as MemberExpression); }
/// <summary> /// Raises this object's PropertyChanged event. /// </summary> /// <typeparam name="T">The type of the property that has a new value</typeparam> /// <param name="propertyExpression">A Lambda expression representing the property that has a new value.</param> protected virtual void OnPropertyChanged <T>(Expression <Func <T> > propertyExpression) { var propertyName = PropertySupport.ExtractPropertyName(propertyExpression); this.OnPropertyChanged(propertyName); }