Ejemplo n.º 1
0
 /// <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);
 }
Ejemplo n.º 2
0
 /// <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);
 }
Ejemplo n.º 3
0
        /// <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);

            OnPropertyChanged(propertyName);
        }