This project has moved. For the latest updates, please go here.

Howto Check if a propertyGrid has Validation Errors

Jun 16, 2015 at 2:36 PM

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 8:15 AM
Ok, got it:
PropertyItemCollection prop = (PropertyItemCollection) propertyGrid.Properties; 
bool validationError = prop.Any(p => p.GetBindingExpression(PropertyItem.ValueProperty).HasValidationError);