We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback
Platform : WPF
|
Category : DataBinding

How to Get or Set a value that indicates whether to include the DataErrorValidationRule ?

Setting this property provides an alternative to use the DataErrorValidationRule element, explicitly. The DataErrorValidationRule is a built-in validation rule that checks for errors that are raised by the "IDataErrorInfo" implementation of the source object. If an error is raised, the binding engine creates a ValidationError with the error and adds it to the "Validation.Errors" collection of the bound element. The lack of an error clears this validation feedback, unless another rule raises a validation issue.

This example shows how to implement validation logic on a custom object and then bind to it.

You can provide validation logic on the business layer if your source object implements IDataErrorInfo, as in the following example. In the following example, the "text" property of the textbox binds to the "Age" property of the Person object which has been made available for binding through a resource declaration that is given in the x:Keydata. The "DataErrorValidationRule" checks for the validation errors raised by the IDataErrorInfo implementation.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon