Validating one property at a time

Topics: Validation Application Block
Feb 10, 2007 at 10:47 PM
Hello,

I'm currently trying to make a custom WPF ValidationRule that delegates the actual validation onto an EntLib Validator.
In XAML you would see something like this...
<TextBox Text="{Binding Path=FirstName}" local:EntlibValidator.ShowErrors=True"/>
ShowErrors is an attached property.
In the OnAttachedPropertyChanged event handler I loop through all field and property members of the element searching for the binding. Once the binding is grabbed its easy to add the custom ValidationRule and pass the databound PropertyName (Binding Path). Now comes the question...I would like to avoid validating the whole business object each time a property changes. So how can I Validate one single property at a time ?
I'm looking for something like ... ValidationResults results = validator.Validate(target, "FirstName");
Would this be possible ?

It would really be nice if we could get some tech info about the upcomming VAB support for WPF.

Cheers,
Christian


Jul 13, 2007 at 10:03 AM
Hi;

I am having the same requirement as described below (validate a single property at a time). Is there any way to do this with Entlib validation block.
I was thinking of a ruleset which could be defined automatically foreach property name or something similar.

Thanks


cziedins wrote:
Hello,

I'm currently trying to make a custom WPF ValidationRule that delegates the actual validation onto an EntLib Validator.
In XAML you would see something like this...
<TextBox Text="{Binding Path=FirstName}" local:EntlibValidator.ShowErrors=True"/>
ShowErrors is an attached property.
In the OnAttachedPropertyChanged event handler I loop through all field and property members of the element searching for the binding. Once the binding is grabbed its easy to add the custom ValidationRule and pass the databound PropertyName (Binding Path). Now comes the question...I would like to avoid validating the whole business object each time a property changes. So how can I Validate one single property at a time ?
I'm looking for something like ... ValidationResults results = validator.Validate(target, "FirstName");
Would this be possible ?

It would really be nice if we could get some tech info about the upcomming VAB support for WPF.

Cheers,
Christian