protected override IEnumerable <IPropertyDefinition> GenerateChildrenProperties() { object value = this.ValueInstance; if (value == null) { return(new IPropertyDefinition[0]); } var propertyDefs = new List <IPropertyDefinition>(); try { PropertyDescriptorCollection descriptors = PropertyGridUtilities.GetPropertyDescriptors(value); foreach (PropertyDescriptor descriptor in descriptors) { if (descriptor.IsBrowsable) { DescriptorPropertyDefinition def = new DescriptorPropertyDefinition(descriptor, this); def.InitProperties(); propertyDefs.Add(def); } } } catch (Exception) { //TODO: handle this some how } return(propertyDefs); }
internal static PropertyItem CreatePropertyItem(PropertyDescriptor property, IPropertyParent propertyParent) { DescriptorPropertyDefinition definition = new DescriptorPropertyDefinition(property, propertyParent); definition.InitProperties(); PropertyItem propertyItem = new PropertyItem(); propertyItem.PropertyDescriptor = property; propertyItem.Instance = propertyParent.ValueInstance; PropertyGridUtilities.InitializePropertyItem(propertyItem, definition); return(propertyItem); }