Custom Control expandable property ordering [solved]
-
If you create a custom control with an expandable property (i.e. it has a "+" in the properties window which expands to show you the individual subfields - similar to the Size property of most controls), how do you control the display order of these sub fields? I have got the control working, with an expandable property containing minWidth, initialWidth and maxWidth, but in the designer they always display in aphabetical order: initialWidth, maxWidth, minWidth. I know it is possible (Size displays as Width first, then Height) - but google is being unhelpful as to how!
All those who believe in psycho kinesis, raise my hand.
-
If you create a custom control with an expandable property (i.e. it has a "+" in the properties window which expands to show you the individual subfields - similar to the Size property of most controls), how do you control the display order of these sub fields? I have got the control working, with an expandable property containing minWidth, initialWidth and maxWidth, but in the designer they always display in aphabetical order: initialWidth, maxWidth, minWidth. I know it is possible (Size displays as Width first, then Height) - but google is being unhelpful as to how!
All those who believe in psycho kinesis, raise my hand.
Hello, In your
ExpandableObjectConverter
you have to override theGetProperties
method, like this:public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
{
return TypeDescriptor.GetProperties(typeof(YourClass), attributes).Sort(new string[] { "FirstProperty", "SecondProperty", "..." });
}Hope it helps!
All the best, Martin
-
Hello, In your
ExpandableObjectConverter
you have to override theGetProperties
method, like this:public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
{
return TypeDescriptor.GetProperties(typeof(YourClass), attributes).Sort(new string[] { "FirstProperty", "SecondProperty", "..." });
}Hope it helps!
All the best, Martin
Martin# wrote:
Hope it helps!
Oh yes! Perfect - thank you!
All those who believe in psycho kinesis, raise my hand.
-
Martin# wrote:
Hope it helps!
Oh yes! Perfect - thank you!
All those who believe in psycho kinesis, raise my hand.