문제

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; 
};
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top