Validating data in wpf

Rated 3.98/5 based on 685 customer reviews

For example I would like to bind button Is Enabled property to that deciding to enable button only in user input is valid.

Simplest way, in my opinion is to check if Text Box has any validation errors and if no – make button enabled, disabled otherwise.

This blog post describes how Binding Groups can be used to address the problem of applying validation rules to multiple objects. NET 3.5 SP1, Vincent Sibal provides a good introduction to this new features on his blog.

validating data in wpf-66

Errors attached property of the element which the Binding Group is associated with.

C1Data Grid has immense flexibility that allows us to add errors manually to the rows.

That's pretty useful in scenarios when binding to simple collections (with no error information) and binding to native datatable.

In this instance, we are only interested in the converted value, hence the Validation Step property is set to Committed Value.

The rule itself is very simple: We simply retrieve both Person instances, apply our rule raising an error if our condition is not met.

Leave a Reply