private PropertyDescriptorCollection PopulateFromPgmList(PropertyDescriptorCollection pdc, List <PropertyGridMember> list) { foreach (PropertyGridMember pgm in list) { TypeConverter converter = pgm.GetTypeConverter(); // new Attribute[] { new CategoryAttribute("Custom Variable") }); pdc = PropertyDescriptorHelper.AddProperty(pdc, pgm.Name, pgm.Type, converter, pgm.Attributes.ToArray(), pgm.ReactToMemberChange, pgm.CustomGetMember ); } return(pdc); }
PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[] attributes) { PropertyDescriptorHelper.CurrentInstance = Instance; PropertyDescriptorCollection pdc = new PropertyDescriptorCollection(null); // TypeDescriptor.GetProperties(this, true); pdc = PropertyDescriptorHelper.RemoveProperty(pdc, "Instance"); pdc = PropertyDescriptorHelper.RemoveProperty(pdc, "PropertyGrid"); List <PropertyGridMember> list = mNativePropertyGridMembers; pdc = PopulateFromPgmList(pdc, list); pdc = PopulateFromPgmList(pdc, mCustomPropertyGridMembers); return(pdc); }