Caliburn.Micro - is it possible to validate on exceptions with convention-based bindings?
-
27-09-2019 - |
문제
I need to validate on exceptions when doing binding. Is this possible using Caliburn.Micro?
Right now I have code that looks like
<TextBox x:Name="FirstName" />
But I get no validation on exceptions. If I change it to
<TextBox Text="{Binding FirstName, Mode=TwoWay, ValidatesOnExceptions=True}" />
Then I get proper validation, but lose the nice convention-based binding. Any ideas?
해결책
Yes. Absolutely. To do this, you must replace ConventionManager.ApplyValidation with your own validation check and application code. You would do this in the Configure method of your bootstrapper so that it would be prepared for use by the framework. You might have something like this:
ConventionManager.ApplyValidation = (binding, viewModelType, property) => {
binding.ValidatesOnExceptions = true;
};
제휴하지 않습니다 StackOverflow