/// <summary> /// Observes a property that is used to determine if this command can execute, and if it implements /// INotifyPropertyChanged it will automatically call DelegateCommandBase.RaiseCanExecuteChanged on property changed /// notifications. /// </summary> /// <param name="canExecuteExpression">The property expression. Example: ObservesCanExecute((o) => PropertyName).</param> /// <returns>The current instance of DelegateCommand</returns> protected internal void ObservesCanExecuteInternal(Expression <Func <object, bool> > canExecuteExpression) { CanExecuteMethod = canExecuteExpression.Compile(); AddPropertyToObserve(PropertySupport.ExtractPropertyNameFromLambda(canExecuteExpression)); HookInpc(canExecuteExpression.Body as MemberExpression); }