You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently we support UI validation by using 2 providers:
FluentValidation (AbstractValidator type)
ComponentModel.DataAnnotations.Validator (ObservableValidator, IValidatableObject and INotifyDataErrorInfo types)
We support individual property validation combined with real-time updates by adding an errors property for each model property:
This way we subscribe to the OnPropertyChanged event in the ViewModel to filter the validation errors based on the property name and assign and raise the appropiate error in UI:
For AbstractValidator instead of manually filtering the errors we only need to call the ValidateAsync() method in the ViewModel and then triggering the UI errors logic from a custom rule:
Finally in the XAML code we are just using a converter to show/hide an errors tooltip based on the related errors property content:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Currently we support UI validation by using 2 providers:
We support individual property validation combined with real-time updates by adding an errors property for each model property:
This way we subscribe to the OnPropertyChanged event in the ViewModel to filter the validation errors based on the property name and assign and raise the appropiate error in UI:
For AbstractValidator instead of manually filtering the errors we only need to call the ValidateAsync() method in the ViewModel and then triggering the UI errors logic from a custom rule:
Finally in the XAML code we are just using a converter to show/hide an errors tooltip based on the related errors property content:
Full sample can be found in this PR: #1174
Beta Was this translation helpful? Give feedback.
All reactions