【问题标题】:How can I expand a ExpandableObjectConverter object in a PropertyGrid automatically?如何在 PropertyGrid 中自动展开 ExpandableObjectConverter 对象?
【发布时间】:2010-11-03 10:46:20
【问题描述】:

我有一个 .net PropertyGrid。我选择要查看的对象,该对象的属性是 Vector3。我可以使用 ExpandableObjectConverter 自动将 Vector3 的属性公开到 PropertyGrid 中。一切都很好,除了选择对象时,我希望默认扩展 Vector3,即无需单击 [+] 即可查看 X、Y 和 Z。我该怎么做?

// Managed C++ :
[TypeConverter(ExpandableObjectConverter::typeid)]
public ref struct Vector3
{
    Vector3(float _x, float _y, float _z) 
        :   x(_x)
        ,   y(_y)
        ,   z(_z)
    {}

    float x, y, z;

    property float X
    {   
        float get()             { return x; }
    }   
    property float Y   
    {   
        float get()             { return y; }
    }   
    property float Z
    {   
        float get()             { return z; }
    }
};

【问题讨论】:

  • 在下面查看我的答案。它能为您提供帮助吗?如果是这样,请接受我的回答(并随时投票;)

标签: .net propertygrid


【解决方案1】:

这里基本上提供了答案: Expand C# propertygrid on show

只需进行一些小的更改即可找到特定属性而不是类别。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-04
    • 2011-08-11
    • 2021-05-08
    • 2016-11-24
    相关资源
    最近更新 更多