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
Had a case where i needed to have validations that stop and block an external process and others that simply display the error without blocking or stopping anything. I also needed to display these validations separately.
To solve that problem, I thinked of having multiple validation contexts in a single ViewModel.
To do so I made overloads for the "ValidationRule(...)" and "BindValidation(...)" methods. I added a "Func<TViewModel, ValidationContext> validationContextProperty" parameter to those methods and use it instead of the one present by default in the "IValidatableViewModel" interface.
I haven't figured out what to do with the default ValidationContext property as I prefer to use custom named ones. It might become a global context where all validations regroups, but validations would lose the context added by the custom name.
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
-
Hi everyone,
Had a case where i needed to have validations that stop and block an external process and others that simply display the error without blocking or stopping anything. I also needed to display these validations separately.
To solve that problem, I thinked of having multiple validation contexts in a single ViewModel.
To do so I made overloads for the "ValidationRule(...)" and "BindValidation(...)" methods. I added a "Func<TViewModel, ValidationContext> validationContextProperty" parameter to those methods and use it instead of the one present by default in the "IValidatableViewModel" interface.
I haven't figured out what to do with the default ValidationContext property as I prefer to use custom named ones. It might become a global context where all validations regroups, but validations would lose the context added by the custom name.
Beta Was this translation helpful? Give feedback.
All reactions