DataBindingValidationProvider

Topics: Development Team Discussion, User Discussion
Coordinator
Sep 12, 2007 at 5:04 PM
I thought it would be nice to implement a new component that looks through Control.DataBindings and given its associated ValidationProvider, automatically fills the SourcePropertyName and ValidatedPropertyName (and maybe the PerformValidation) properties.

This would reduce maintenance when using DataBinding on having to make sure that all bound fields are correctly set on the ValidationProvider.

Any thoughts?
Developer
Sep 26, 2007 at 3:34 AM
I'm working on a better approach that extends the built-in Binding with automatic support for VAB.
It allows you to write your bindings just as you would with regular Binding, but with the new ValidationBinding:

 
<TextBox Text="{l:ValidationBinding Child.IntValue}" />
 

The new ValidationBinding wraps a Binding with its full intact behavior, and transparently adds a ValidationRule to perform validation using the binding source property validation criteria. It caches the Validator so it's quite performant, and also supports cross-property validation scenarios.

I'll release this as part of the SVAB Standalone Validation Block 0.5, and maybe provide it for the unmodified EntLib too (isn't as straightforward because of the internal PropertyValidatorFactory class :(, which I may need to copy/paste)
Developer
Sep 26, 2007 at 3:35 AM
Some "entertaining" details of what I've faced implementing this can be found at my blog.