Form's awareness of failed validation

Feb 2, 2009 at 9:45 AM
Hi; thank you for a great framework :)

I analyzed the projects posted on CodeProject (WpfInterceptionValidation & WpfStateValidation). One thing i did not see is a way to know whether validation on the form failed on any field to prevent object saving by the business logic. Since the validator will throw exception, the offending value won't be set on business object's field; therefore even if we run custom validator on that business object we won't know of validation failure as each field contains matching (but not full) value

Am I missing something obvious?

thanks

Coordinator
Feb 2, 2009 at 11:20 AM

Hi,
WPF Validation is being used here so you can just query the GetHasError(...) method of the the Validation AttachedProperty.

eg, if you had a TextBox named "AgeTextBox" which had validation applied to its bound property on the model, you would call
bool isValid = Validation.GetHasError(AgeTextBox)

So when the user hits ok you could iterate through all the controls on the dialog and query whther it was valid or not.


On Mon Feb 2 9:45 , valeks sent:

From: valeks

Hi; thank you for a great framework :)

I analyzed the projects posted on CodeProject (WpfInterceptionValidation & WpfStateValidation). One thing i did not see is a way to know whether validation on the form failed on any field to prevent object saving by the business logic. Since the validator will throw exception, the offending value won't be set on business object's field; therefore even if we run custom validator on that business object we won't know of validation failure as each field contains matching (but not full) value

Am I missing something obvious?

thanks