最佳答案
您需要使用 [TypeConverter(typeof(ExpandableObjectConverter))]
对其进行修饰,以使子属性显示在编辑器中。
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();
}
属性现在可以展开。
关于c# - 如何使用类作为属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50181647/