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); } } ); }
public void Revalidate( IVMPropertyDescriptor property, ValidationScope scope = ValidationScope.Self ) { Revalidator.RevalidatePropertyValidations(_vm, property, scope); }
protected override void RevalidateDescendantsCore(IBehaviorContext context, ValidationScope scope) { var childVM = this.GetValueNext <TValue>(context); if (childVM != null) { Revalidator.Revalidate(childVM, scope); } }
private void ValidateItems(IEnumerable <TItemVM> items) { var enumerableItems = (IEnumerable <IViewModel>)items; Revalidator.RevalidateItems( enumerableItems, ValidationScope.SelfAndLoadedDescendants ); }
internal void RefreshInternal(IVMPropertyDescriptor property, RefreshOptions options) { _descriptor.Behaviors.ViewModelRefreshNext(this, property, options); // Refresh does not revalidate the property value itself. Descendants are // automatically validated by the appropriate behaviors. Revalidator.RevalidatePropertyValidations( _vm, property, ValidationScope.Self ); }
private void ValidateItem(IViewModel item) { Revalidator.Revalidate(item, ValidationScope.SelfAndLoadedDescendants); }
internal void RefreshInternal(bool executeRefreshDependencies = false) { RefreshWithoutValidation(executeRefreshDependencies); Revalidator.Revalidate(_vm, ValidationScope.SelfAndLoadedDescendants); }
public void Revalidate(ValidationScope scope) { Revalidator.Revalidate(_vm, scope); }
protected override void RevalidateDescendantsCore(IBehaviorContext context, ValidationScope scope) { var items = (IEnumerable <IViewModel>) this.GetValueNext <IVMCollection <TItemVM> >(context); Revalidator.RevalidateItems(items, scope); }