title: PropertyGrid display class members that are also classes
body: <p>I have the <strong>class PGMain as the SelectedObject in the propertygrid</strong>:</p>
  
  <pre><code>         [DefaultPropertyAttribute("Basic")]
  [Serializable]
  public class PGMain
  {    
      private TestClass m_TEST = new TestClass();
      [CategoryAttribute("TEST")]
      public TestClass TEST
      {
          get { return m_TEST; }
          set { m_TEST = value; }
  }
      // More members are here
  }
  </code></pre>
  
  <p>Now I would like to expand the members of the TestClass in the PropertyGrid. So I tried the following:</p>
  
  <pre><code>   [Serializable]
  [DescriptionAttribute("Expand to see the options for the application.")]
  [TypeConverter(typeof(ExpandableObjectConverter))]
  public class TestClass : ExpandableObjectConverter
  {
      [CategoryAttribute("test-cat"), DescriptionAttribute("desc")]        
      public string Name = "";
      [CategoryAttribute("test-cat"), DescriptionAttribute("desc")]
      public object Value = null;
      [CategoryAttribute("test-cat"), DescriptionAttribute("desc")]
      public bool Include = true;
  
      public override bool CanConvertTo(ITypeDescriptorContext context, System.Type destinationType)
      {
          if (destinationType == typeof(TestClass))
              return true;
  
          return base.CanConvertTo(context, destinationType);
      }
  }
  </code></pre>
  
  <p>The result is that there is an expandable-icon in front of the TestClass in the propertygrid but it can not be expanded. What am I missing?
  Just to be clear: I can show expandable members of the PGMain class but NOT expandable members of the members of the PGMain class like the Test-member in PGMain.</p>
  
  <hr>
  
  <p>Edit:</p>
  
  <p>No I have 2 classes NOT 1.</p>
  
  <pre><code>  [DefaultPropertyAttribute("Basic")]
  [TypeConverter(typeof(ExpandableObjectConverter))]
  public class fooA
  {
      private fooB m_TestMember = new fooB();
      [Browsable(true)]
      [CategoryAttribute("Test category"), DescriptionAttribute("desctiption here")] // &lt;&lt;&lt;&lt;&lt; this one works.
      [TypeConverter(typeof(fooB))]
      public fooB TestMember
      {
          get { return m_TestMember; }
          set { m_TestMember = value; }
      }
  
  }
  
  [DefaultPropertyAttribute("Basic")]
  [TypeConverter(typeof(ExpandableObjectConverter))]
  public class fooB
  {
      private string m_ShowThisMemberInGrid = "it works"; // &lt;&lt;&lt;&lt;&lt; this doesn NOT work
      [CategoryAttribute("Tile"), DescriptionAttribute("desctiption here")]
      public string ShowThisMemberInGrid
      {
          get { return m_ShowThisMemberInGrid; }
          set { m_ShowThisMemberInGrid = value; }
      }
  
      public override string ToString()
      {
          return "foo B";
      }
  }
  </code></pre>
  
  <p>But I did solve the problem (by coincidence). It appears that public variables are not listed in the propertygrid. It HAVE to be properties with getters and setters. That was the solution. So the above snippet solved the problem. Thanks for your replies anyway :).</p>