// Your custom data type
public class MySize
{
...
public int Width{get{...}set{...}}
public int Height{get{...}set{...}}
}
For example, in the above class (MySize) if you want to your properties ‘Width’ and ‘Height’ to
appear in that order, you should provide this override:
public override bool GetPropertiesSupported(ITypeDescriptorContext context)
{
return true;
}
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
{
System.ComponentModel.PropertyDescriptorCollection propertyDescriptorCollection;
string[] propNames;
propertyDescriptorCollection =
TypeDescriptor.GetProperties(typeof(System.Drawing.Size),attributes);
propNames = (string[])new System.String[2];
propNames[0] = @'Width';
propNames[1] = @'Height';
return propertyDescriptorCollection0.Sort(propNames);
} // end of method GetProperties
Share with