Browse Source

Merge pull request #4704 from KieranDevvs/control-validation-message-fix

Control data validation fix
repro/bound-listboxes
Steven Kirk 6 years ago
committed by GitHub
parent
commit
10ee2d2de5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/Avalonia.Base/Data/Core/Plugins/DataAnnotationsValidationPlugin.cs
  2. 4
      tests/Avalonia.Base.UnitTests/Data/Core/Plugins/DataAnnotationsValidationPluginTests.cs

4
src/Avalonia.Base/Data/Core/Plugins/DataAnnotationsValidationPlugin.cs

@ -63,12 +63,12 @@ namespace Avalonia.Data.Core.Plugins
{ {
if (errors.Count == 1) if (errors.Count == 1)
{ {
return new ValidationException(errors[0].ErrorMessage); return new DataValidationException(errors[0].ErrorMessage);
} }
else else
{ {
return new AggregateException( return new AggregateException(
errors.Select(x => new ValidationException(x.ErrorMessage))); errors.Select(x => new DataValidationException(x.ErrorMessage)));
} }
} }
} }

4
tests/Avalonia.Base.UnitTests/Data/Core/Plugins/DataAnnotationsValidationPluginTests.cs

@ -59,12 +59,12 @@ namespace Avalonia.Markup.UnitTests.Data.Plugins
{ {
new BindingNotification(5), new BindingNotification(5),
new BindingNotification( new BindingNotification(
new ValidationException(errmsg), new DataValidationException(errmsg),
BindingErrorType.DataValidationError, BindingErrorType.DataValidationError,
3), 3),
new BindingNotification(7), new BindingNotification(7),
new BindingNotification( new BindingNotification(
new ValidationException(errmsg), new DataValidationException(errmsg),
BindingErrorType.DataValidationError, BindingErrorType.DataValidationError,
11), 11),
}, result); }, result);

Loading…
Cancel
Save