// Token: 0x06005982 RID: 22914 RVA: 0x0018B36C File Offset: 0x0018956C
        internal static void RemoveValidationError(ValidationError validationError, DependencyObject targetElement, bool shouldRaiseEvent)
        {
            if (targetElement == null)
            {
                return;
            }
            ValidationErrorCollection errorsInternal = Validation.GetErrorsInternal(targetElement);

            if (errorsInternal == null || errorsInternal.Count == 0 || !errorsInternal.Contains(validationError))
            {
                return;
            }
            bool flag = errorsInternal.Count == 1;

            if (flag)
            {
                targetElement.ClearValue(Validation.HasErrorPropertyKey);
                targetElement.ClearValue(Validation.ValidationErrorsInternalProperty);
                if (shouldRaiseEvent)
                {
                    Validation.OnValidationError(targetElement, validationError, ValidationErrorEventAction.Removed);
                }
                Validation.ShowValidationAdorner(targetElement, false);
                return;
            }
            errorsInternal.Remove(validationError);
            if (shouldRaiseEvent)
            {
                Validation.OnValidationError(targetElement, validationError, ValidationErrorEventAction.Removed);
            }
        }
        // Token: 0x06005975 RID: 22901 RVA: 0x0018B004 File Offset: 0x00189204
        private static void OnValidationAdornerSiteChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (e.IsASubPropertyChange)
            {
                return;
            }
            DependencyObject dependencyObject  = (DependencyObject)e.OldValue;
            DependencyObject dependencyObject2 = (DependencyObject)e.NewValue;

            if (dependencyObject != null)
            {
                dependencyObject.ClearValue(Validation.ValidationAdornerSiteForProperty);
            }
            if (dependencyObject2 != null && d != Validation.GetValidationAdornerSiteFor(dependencyObject2))
            {
                Validation.SetValidationAdornerSiteFor(dependencyObject2, d);
            }
            if (Validation.GetHasError(d))
            {
                if (dependencyObject == null)
                {
                    dependencyObject = d;
                }
                Validation.ShowValidationAdornerHelper(d, dependencyObject, false);
                Validation.ShowValidationAdorner(d, true);
            }
        }
        // Token: 0x06005981 RID: 22913 RVA: 0x0018B2F8 File Offset: 0x001894F8
        internal static void AddValidationError(ValidationError validationError, DependencyObject targetElement, bool shouldRaiseEvent)
        {
            if (targetElement == null)
            {
                return;
            }
            ValidationErrorCollection validationErrorCollection = Validation.GetErrorsInternal(targetElement);
            bool flag;

            if (validationErrorCollection == null)
            {
                flag = true;
                validationErrorCollection = new ValidationErrorCollection();
                validationErrorCollection.Add(validationError);
                targetElement.SetValue(Validation.ValidationErrorsInternalProperty, validationErrorCollection);
            }
            else
            {
                flag = (validationErrorCollection.Count == 0);
                validationErrorCollection.Add(validationError);
            }
            if (flag)
            {
                targetElement.SetValue(Validation.HasErrorPropertyKey, BooleanBoxes.TrueBox);
            }
            if (shouldRaiseEvent)
            {
                Validation.OnValidationError(targetElement, validationError, ValidationErrorEventAction.Added);
            }
            if (flag)
            {
                Validation.ShowValidationAdorner(targetElement, true);
            }
        }
 // Token: 0x06005972 RID: 22898 RVA: 0x0018AFB0 File Offset: 0x001891B0
 private static void OnErrorTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     if (Validation.GetHasError(d))
     {
         Validation.ShowValidationAdorner(d, false);
         Validation.ShowValidationAdorner(d, true);
     }
 }