This project has moved and is read-only. For the latest updates, please go here.

Howto Check if a propertyGrid has Validation Errors

Jun 16, 2015 at 3:36 PM
Hi,

maybe a stupid question, but how can I check (from code behind) if any of the propertyGrid items has a validation error?

I can see that the validation failed (get the red border etc). But how can I query for validation errors?

Thx Andreas
Jun 17, 2015 at 9:15 AM
Ok, got it:
PropertyItemCollection prop = (PropertyItemCollection) propertyGrid.Properties; 
bool validationError = prop.Any(p => p.GetBindingExpression(PropertyItem.ValueProperty).HasValidationError);