public static PropertyDescriptor GetValidationProperty (object o)
{
PropertyDescriptorCollection props;
System.ComponentModel.AttributeCollection col;
props = TypeDescriptor.GetProperties (o);
col = TypeDescriptor.GetAttributes (o);
foreach (Attribute at in col) {
ValidationPropertyAttribute vpa = at as ValidationPropertyAttribute;
if (vpa != null && vpa.Name != null)
return props[vpa.Name];
}
return null;
}