예제 #1
0
 public ViewModelScopeTaskBase(TViewModel viewModel, IEnumerable <IScopeAspect> aspects)
     : base(aspects)
 {
     viewModel.PushActiveScope(this);
     ViewModel = viewModel;
     _aspects.Insert(0,
                     new PropertyNotificationScopeAspect(
                         (obj, props) => PropertyNotificationManager <TViewModel> .PropagateNotification(viewModel, props)));
 }
        /// <summary>
        /// Tells whether the target property depends on the properties referenced by the param <paramref name="propertyNames"/>
        /// </summary>
        /// <param name="propertyNames">names of the dependency properties</param>
        /// <returns>this</returns>
        public ViewModelPropertyDescriptor <TOwner, TResult> DependOn(params string[] propertyNames)
        {
            PropertyNotificationManager <TOwner> .DependOn(PropertyName, propertyNames);

            return(this);
        }
        /// <summary>
        /// Tells whether the target property depends on the property referenced by the param <paramref name="exp"/>
        /// </summary>
        /// <typeparam name="TDependencyResult">The type of the dependency property</typeparam>
        /// <param name="exp">Expression refering the dependency property</param>
        /// <returns>this</returns>
        public ViewModelPropertyDescriptor <TOwner, TResult> DependOn <TDependencyResult>(Expression <Func <TOwner, TDependencyResult> > exp)
        {
            PropertyNotificationManager <TOwner> .DependOn(PropertyName, ((MemberExpression)exp.Body).Member.Name);

            return(this);
        }