Reputation: 97
I tried using class as a property but I can't change it's sub properties in the "Properties Tab"
I want to make a property like the Font
property
in this picture
Upvotes: 6
Views: 182
Reputation: 11273
You need to decorate it with [TypeConverter(typeof(ExpandableObjectConverter))]
to get the sub-properties to show up in the editor.
public struct MyStruct
{
public int One;
public int Two;
public int Three;
}
public class MyEditableClass : Control
{
[TypeConverter(typeof(ExpandableObjectConverter))]
public MyStruct MyProperty { get; set; } = new MyStruct();
}
The properties will now be expandable.
Upvotes: 8