public override PropertyDescriptorCollection GetProperties(Attribute[] attributes) { ParameterClass pc = ClassPointer as ParameterClass; if (pc != null) { return(pc.GetProperties(attributes)); } return(base.GetProperties(attributes)); }
public virtual PropertyDescriptorCollection GetProperties(Attribute[] attributes) { PropertyDescriptorCollection baseProps; ParameterClass pc = _componentPointer as ParameterClass; if (pc != null) { baseProps = pc.GetProperties(attributes); } else { baseProps = TypeDescriptor.GetProperties(_componentPointer, attributes, true); if (ReadOnly) { List <PropertyDescriptor> ps = new List <PropertyDescriptor>(); foreach (PropertyDescriptor p in baseProps) { List <Attribute> aa = new List <Attribute>(); if (p.Attributes != null) { foreach (Attribute a in p.Attributes) { if (!(a is EditorAttribute)) { aa.Add(a); } } } object v = p.GetValue(_componentPointer); string s; if (v == null) { s = ""; } else { s = v.ToString(); } PropertyDescriptorForDisplay r = new PropertyDescriptorForDisplay(_componentPointer.GetType(), p.Name, s, aa.ToArray()); ps.Add(r); } baseProps = new PropertyDescriptorCollection(ps.ToArray()); } } IList <PropertyDescriptor> lst = OnGetProperties(attributes); if (lst != null && lst.Count > 0) { PropertyDescriptor[] pa = new PropertyDescriptor[baseProps.Count + lst.Count]; baseProps.CopyTo(pa, 0); lst.CopyTo(pa, baseProps.Count); baseProps = new PropertyDescriptorCollection(pa); } return(baseProps); }