The PropertyGrid control is very useful for editing objects at run-time. I'm using it as follows:
Form form = new Form();
form.Parent = this;
form.Text = "Editing MyMemberVariable";
PropertyGrid p = new PropertyGrid();
p.Parent = form;
p.Dock = DockStyle.Fill;
p.SelectedObject = _MyMemberVariable;
p.PropertyValueChanged += delegate(object s, PropertyValueChangedEventArgs args)
{
_MyMemberVariable.Invalidate();
};
form.Show();
As you can see, I'm using the PropertyValueChanged notification to figure out when to update _MyMemberVariable. However, _MyMemberVariable is a class that I didn't write, and one of its members is a Collection type. The PropertyGrid calls the Collection Editor to edit this type. However, when the Collection Editor is closed, I do not get a PropertyValueChanged notification.
Obviously, I could work around this problem by using ShowDialog() and invalidating _MyMemberVariable after the dialog is closed.
But I'd like to actually get PropertyValueChanged events to fire when collections have been edited. Is there a way to do that without modifying _MyMemberVariable (I don't have access to its source code)?