public override PropertyDescriptorCollection GetChildProperties(object instance, Attribute[] filter) { PropertyDescriptorCollection pdc = null; var tc = this.Converter; if (tc.GetPropertiesSupported(null) == false) { pdc = base.GetChildProperties(instance, filter); } else { } if (propertyDescriptor != null) { tc = propertyDescriptor.Converter; } else { //pdc = base.GetChildProperties(instance, filter);// this gives us a readonly collection, no good tc = TypeDescriptor.GetConverter(instance, true); } if (pdc == null || pdc.Count == 0) { return(pdc); } if (pdc[0] is CustomPropertyDescriptor) { return(pdc); } // now wrap these properties with our CustomPropertyDescriptor var pdl = new PropertyDescriptorList( ); foreach (PropertyDescriptor pd in pdc) { if (pd is CustomPropertyDescriptor) { pdl.Add(pd as CustomPropertyDescriptor); } else { pdl.Add(new CustomPropertyDescriptor(instance, pd)); } } pdl.Sort(new PropertySorter( )); var pdcReturn = new PropertyDescriptorCollection(pdl.ToArray( )); pdcReturn.Sort( ); return(pdcReturn); }
public override sealed PropertyDescriptorCollection GetProperties() { if (propertyDescriptorList.Count == 0) { var pdc = base.GetProperties(); // this gives us a readonly collection, no good foreach (PropertyDescriptor pd in pdc) { if (!(pd is CustomPropertyDescriptor)) { var cpd = new CustomPropertyDescriptor(base.GetPropertyOwner(pd), pd); propertyDescriptorList.Add(cpd); } } } var pdl = propertyDescriptorList.FindAll(pd => pd != null); PreProcess(pdl); var pdcReturn = new PropertyDescriptorCollection(propertyDescriptorList.ToArray()); return(pdcReturn); }
public override PropertyDescriptorCollection GetChildProperties( object instance, Attribute[] filter ) { PropertyDescriptorCollection pdc = null; var tc = this.Converter; if (tc.GetPropertiesSupported(null) == false) { pdc = base.GetChildProperties(instance, filter); } else { } if (propertyDescriptor != null) { tc = propertyDescriptor.Converter; } else { //pdc = base.GetChildProperties(instance, filter);// this gives us a readonly collection, no good tc = TypeDescriptor.GetConverter(instance, true); } if (pdc == null || pdc.Count == 0) { return pdc; } if (pdc[0] is CustomPropertyDescriptor) { return pdc; } // now wrap these properties with our CustomPropertyDescriptor var pdl = new PropertyDescriptorList( ); foreach (PropertyDescriptor pd in pdc) { if (pd is CustomPropertyDescriptor) { pdl.Add(pd as CustomPropertyDescriptor); } else { pdl.Add(new CustomPropertyDescriptor(instance, pd)); } } pdl.Sort(new PropertySorter( )); var pdcReturn = new PropertyDescriptorCollection(pdl.ToArray( )); pdcReturn.Sort( ); return pdcReturn; }