Selaa lähdekoodia

Removed vestiges of old data validation.

Steven Kirk 9 vuotta sitten
vanhempi
sitoutus
4fe2a3d86c

+ 0 - 29
src/Avalonia.Base/AvaloniaObject.cs

@@ -352,7 +352,6 @@ namespace Avalonia
                     GetDescription(source));
 
                 IDisposable subscription = null;
-                IDisposable validationSubcription = null;
 
                 if (_directBindings == null)
                 {
@@ -363,15 +362,11 @@ namespace Avalonia
                     .Select(x => CastOrDefault(x, property.PropertyType))
                     .Do(_ => { }, () => _directBindings.Remove(subscription))
                     .Subscribe(x => DirectBindingSet(property, x));
-                validationSubcription = source
-                    .OfType<BindingNotification>()
-                    .Subscribe(x => DataValidationChanged(property, x));
 
                 _directBindings.Add(subscription);
 
                 return Disposable.Create(() =>
                 {
-                    validationSubcription.Dispose();
                     subscription.Dispose();
                     _directBindings.Remove(subscription);
                 });
@@ -466,30 +461,6 @@ namespace Avalonia
             }
         }
 
-        /// <inheritdoc/>
-        void IPriorityValueOwner.DataValidationChanged(PriorityValue sender, BindingNotification status)
-        {
-            var property = sender.Property;
-            DataValidationChanged(property, status);
-        }
-
-        /// <summary>
-        /// Called when the validation state on a tracked property is changed.
-        /// </summary>
-        /// <param name="property">The property whose validation state changed.</param>
-        /// <param name="status">The new validation state.</param>
-        protected virtual void DataValidationChanged(AvaloniaProperty property, BindingNotification status)
-        {
-        }
-
-        /// <summary>
-        /// Updates the validation status of the current object.
-        /// </summary>
-        /// <param name="status">The new validation status.</param>
-        protected void UpdateValidationState(BindingNotification status)
-        {
-        }
-
         /// <inheritdoc/>
         Delegate[] IAvaloniaObjectDebug.GetPropertyChangedSubscribers()
         {

+ 0 - 7
src/Avalonia.Base/IPriorityValueOwner.cs

@@ -17,12 +17,5 @@ namespace Avalonia
         /// <param name="oldValue">The old value.</param>
         /// <param name="newValue">The new value.</param>
         void Changed(PriorityValue sender, object oldValue, object newValue);
-
-        /// <summary>
-        /// Called when the validation state of a <see cref="PriorityValue"/> changes.
-        /// </summary>
-        /// <param name="sender">The source of the change.</param>
-        /// <param name="status">The validation status.</param>
-        void DataValidationChanged(PriorityValue sender, BindingNotification status);
     }
 }

+ 5 - 9
src/Avalonia.Base/PriorityBindingEntry.cs

@@ -97,20 +97,16 @@ namespace Avalonia
 
             if (notification != null)
             {
-                if (notification.ErrorType == BindingErrorType.Error)
-                {
-                    _owner.Error(this, notification);
-                }
-                else if (notification.ErrorType == BindingErrorType.DataValidationError)
-                {
-                    _owner.Validation(this, notification);
-                }
-
                 if (notification.HasValue)
                 {
                     Value = notification.Value;
                     _owner.Changed(this);
                 }
+
+                if (notification.ErrorType != BindingErrorType.None)
+                {
+                    _owner.Error(this, notification);
+                }
             }
             else
             {

+ 0 - 11
src/Avalonia.Base/PriorityLevel.cs

@@ -164,17 +164,6 @@ namespace Avalonia
             _owner.LevelError(this, error);
         }
 
-        /// <summary>
-        /// Invoked when an entry in <see cref="Bindings"/> reports validation status.
-        /// </summary>
-        /// <param name="entry">The entry that completed.</param>
-        /// <param name="validationStatus">The validation status.</param>
-        public void Validation(PriorityBindingEntry entry, BindingNotification validationStatus)
-        {
-            _owner.LevelValidation(this, validationStatus);
-        }
-
-
         /// <summary>
         /// Activates the first binding that has a value.
         /// </summary>

+ 0 - 10
src/Avalonia.Base/PriorityValue.cs

@@ -178,16 +178,6 @@ namespace Avalonia
             }
         }
 
-        /// <summary>
-        /// Called whenever a priority level validation state changes.
-        /// </summary>
-        /// <param name="priorityLevel">The priority level of the changed entry.</param>
-        /// <param name="validationStatus">The validation status.</param>
-        public void LevelValidation(PriorityLevel priorityLevel, BindingNotification validationStatus)
-        {
-            _owner.DataValidationChanged(this, validationStatus);
-        }
-
         /// <summary>
         /// Called when a priority level encounters an error.
         /// </summary>

+ 0 - 8
src/Avalonia.Controls/Control.cs

@@ -108,7 +108,6 @@ namespace Avalonia.Controls
             PseudoClass(IsEnabledCoreProperty, x => !x, ":disabled");
             PseudoClass(IsFocusedProperty, ":focus");
             PseudoClass(IsPointerOverProperty, ":pointerover");
-            ////PseudoClass(ValidationStatusProperty, status => !status.IsValid, ":invalid");
         }
 
         /// <summary>
@@ -400,13 +399,6 @@ namespace Avalonia.Controls
         /// </summary>
         protected IPseudoClasses PseudoClasses => Classes;
 
-        /// <inheritdoc/>
-        protected override void DataValidationChanged(AvaloniaProperty property, BindingNotification status)
-        {
-            base.DataValidationChanged(property, status);
-            ////ValidationStatus.UpdateValidationStatus(status);
-        }
-
         /// <summary>
         /// Sets the control's logical parent.
         /// </summary>

+ 0 - 8
src/Avalonia.Controls/TextBox.cs

@@ -235,14 +235,6 @@ namespace Avalonia.Controls
             HandleTextInput(e.Text);
         }
 
-        protected override void DataValidationChanged(AvaloniaProperty property, BindingNotification status)
-        {
-            if (property == TextProperty)
-            {
-                UpdateValidationState(status);
-            }
-        }
-
         private void HandleTextInput(string input)
         {
             if (!IsReadOnly)

+ 0 - 8
tests/Avalonia.Markup.Xaml.UnitTests/Data/BindingTests_Validation.cs

@@ -124,14 +124,6 @@ namespace Avalonia.Markup.Xaml.UnitTests.Data
                     SetValue(ValidationTestProperty, value);
                 }
             }
-
-            protected override void DataValidationChanged(AvaloniaProperty property, BindingNotification status)
-            {
-                if (property == ValidationTestProperty)
-                {
-                    UpdateValidationState(status);
-                }
-            }
         }
         
         private class ValidationTestModel