Pages

Sunday 5 October 2008

Validation and Conversion

The default order is for the ValidationRule to be called before the ConvertBack method of the IValueConverter. This means that the ValidationRule may have to do the same conversion as the converter before it can do the validation.

This order can be changed by specifying the ValidationStep.

<TextBox
MinWidth="100"
Style="{StaticResource tbStyle}"
>
<Binding Path="Dob" Converter="{StaticResource dateFormattingConverter}">
<Binding.ValidationRules>
<app:DobValidationRule ValidationStep="ConvertedProposedValue"/>
</Binding.ValidationRules>
</Binding>
</TextBox>

No comments: