views:

48

answers:

1

In C#, I have a class set up like so:

class Page
{
  public class Element
  {
   private string test;
   public string Test
   { get { return test; } set { test = value; } }
  }

 private Element element;
 public Element PrimaryElement
 { get { return element; } set { element = value; } }
}

If I have a PropertyGrid where the select object is an instance of Page, how can I modify Test in its member PrimaryElement from the PropertyGrid? It shows up in grey and is not expandable nor editable.

+1  A: 

Add this to your Element type or to your PrimaryElement property:

[TypeConverter(typeof(ExpandableObjectConverter))]
Nicolas Cadilhac