/// <summary> /// Caches the tree. /// </summary> /// <param name="validationControl">The validation control.</param> private static void CacheTree(ValidationControl validationControl) { switch (validationControl.ValidationMethod) { case TreeType.LogicalTree: CacheLogicalTree(validationControl, validationControl._fields); break; case TreeType.VisualTree: CacheVisualTree(validationControl, validationControl._fields); break; } }
/// <summary> /// Validates the tree. /// </summary> /// <param name="dependencyObject">The dependency object.</param> /// <param name="errors">The errors.</param> /// <param name="validationControl">The validation control.</param> private static void ValidateTree(DependencyObject dependencyObject, ReadOnlyErrorCollection errors, ValidationControl validationControl) { switch (validationControl.ValidationMethod) { case TreeType.LogicalTree: ValidateLogicalTree(dependencyObject, errors); break; case TreeType.VisualTree: ValidateVisualTree(dependencyObject, errors); break; } }
/// <summary> /// Validates the cache. /// </summary> /// <param name="validationControl">The validation control.</param> private static void ValidateCache(ValidationControl validationControl) { if (validationControl._fields == null) { validationControl._fields = new List <UIElement>(); CacheTree(validationControl); } else if (validationControl._fields.Count == 0) { CacheTree(validationControl); } var errors = validationControl.Errors; foreach (var dependencyObject in validationControl._fields) { Validate(dependencyObject, errors); } }
/// <summary> /// Validates the cache. /// </summary> /// <param name="validationControl">The validation control.</param> private static void ValidateCache(ValidationControl validationControl) { if (validationControl._fields == null) { validationControl._fields = new List<UIElement>(); CacheTree(validationControl); } else if (validationControl._fields.Count == 0) { CacheTree(validationControl); } var errors = validationControl.Errors; foreach (var dependencyObject in validationControl._fields) { Validate(dependencyObject, errors); } }