Posted 7 years ago
by Neil Larson
private void ThePropertyGrid_PropertyChildAdded(object sender, PropertyModelChildChangeEventArgs e)
{
PropertyGrid grid = sender as PropertyGrid;
if (grid == null)
return;
for (int i = 0; i < grid.Items.Count; i++)
{
PropertyDescriptorPropertyModel m = grid.Items[i] as PropertyDescriptorPropertyModel;
if(m != null)
{
if (Object.ReferenceEquals(m.Value, e.ChildValue))
{
m.IsExpanded = true;
return;
}
}
}
}
I use this to expand the item just added by the user. It would be a bit easier if e.ChildPropertyModel was not null, but this works too.
Neil