At the moment I have an object of type A which is being viewed by the PropertyGrid. However, one of its properties is of type B. The property which is of type B is not expandable. How can I change this so that:
a) I can expand custom object property's b) Those changes are bound to that property
Here is the code I have so far:
using System;
using System.Windows.Forms;
using System.ComponentModel;
namespace PropGridTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
A a = new A
{
Foo = "WOO HOO!",
Bar = 10,
BooFar = new B
{
FooBar = "HOO WOO!",
BarFoo = 100
}
};
propertyGrid1.SelectedObject = a;
}
}
public class A
{
public string Foo { get; set; }
public int Bar { get; set; }
public B BooFar { get; set; }
}
public class B
{
public string FooBar { get; set; }
public int BarFoo { get; set; }
}
}