// 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: 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);
            }
        }