Saturday, November 30, 2013

Exception Validation in WPF

By default WPF provides validation control template which displays red border around the control whose input is being validated.

There are two simple ways one can indicate validation error due to exception.

             

<Binding.ValidatesOnExceptions>True</Binding.ValidatesOnExceptions>


Or by specifying ValidatingRules and including an instance of built-in ExceptionValidationRule.

                    <Binding.ValidationRules>
                        <ExceptionValidationRule></ExceptionValidationRule>
                    </Binding.ValidationRules>


No comments:

Post a Comment