I created a class to display in a PropertyGrid that contains another class; I would like this class to expand, so I tried adding [TypeConverter(typeof(ExpandableObjectConverter))] , but it does not work. Here is a simple example I tried:
public partial class Form1 : Form { public Form1() { InitializeComponent(); this.propertyGrid1.SelectedObject = new Class1(); } } public class Class1 { string name; public string Name { get { return this.name; } set { this.name = value; } } Class2 class2; public Class2 Class2 { get { return this.class2; } set { this.class2 = value; } } } [TypeConverter(typeof(ExpandableObjectConverter))] public class Class2 { string stuff = "none"; public string Stuff { get { return this.stuff; } set { this.stuff = value; } } }
When displayed in a property grid, the Class2 property of an instance of Class1 cannot expand. Any idea on why this is not working?
Thanks!
source share