4

I have a .net PropertyGrid. I select an object to view, and a property of that object is a Vector3. I can use ExpandableObjectConverter to automatically expose the properties of the Vector3 into in the PropertyGrid. All fine, except that when the object is selected I'd like the Vector3 to be expanded by default, i.e. so you can see X, Y & Z without having to click [+]. How can I do this?

// 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; }
    }
};
Nick
  • 27,566
  • 12
  • 60
  • 72
  • See my answer below. Did this work for you? If so, please accept my answer (and feel free to vote up as well ;) – Peladao Jan 28 '11 at 15:37

1 Answers1

0

The answer is basically provided here: Expand C# propertygrid on show

Only some small changes are needed to find the specifc property instead of a category.

Community
  • 1
  • 1
Peladao
  • 4,036
  • 1
  • 23
  • 43