Exemplo n.º 1
0
        public void SetValue(IBehaviorContext context, TValue value)
        {
            DetectValidationResultChange(
                context,
                delegate {
                TValue previousChild = this.GetValueNext <TValue>(context);

                // The former parent of 'previousChild' (= still the current value of the
                // property) was already removed by the 'ViewModelInitializerBehavior'.
                if (previousChild != null)
                {
                    Revalidator.Revalidate(previousChild, ValidationScope.SelfAndLoadedDescendants);
                }

                this.SetValueNext(context, value);

                // We MUST revalidate the value after updated the property value defined by
                // ancestors would not match before (because the 'PathDefinition' calls
                // 'GetValue' when matching paths). The drawback is that the new view model
                // is not revalidated yet when 'PropertyChanged' is raised. If this becomes
                // a problem, it would be possible to cache the new child VM temporarily and
                // return it in 'GetValue' if one is cached.
                if (value != null)
                {
                    Revalidator.Revalidate(value, ValidationScope.SelfAndLoadedDescendants);
                }
            }
                );
        }
Exemplo n.º 2
0
        protected override void RevalidateDescendantsCore(IBehaviorContext context, ValidationScope scope)
        {
            var childVM = this.GetValueNext <TValue>(context);

            if (childVM != null)
            {
                Revalidator.Revalidate(childVM, scope);
            }
        }
Exemplo n.º 3
0
 internal void RefreshInternal(bool executeRefreshDependencies = false)
 {
     RefreshWithoutValidation(executeRefreshDependencies);
     Revalidator.Revalidate(_vm, ValidationScope.SelfAndLoadedDescendants);
 }
 private void ValidateItem(IViewModel item)
 {
     Revalidator.Revalidate(item, ValidationScope.SelfAndLoadedDescendants);
 }
Exemplo n.º 5
0
 public void Revalidate(ValidationScope scope)
 {
     Revalidator.Revalidate(_vm, scope);
 }