public static IEnumerable <GridItem> EnumerateGroups(this PropertyGrid propertyGrid) { if (propertyGrid.SelectedGridItem == null) { yield break; } foreach (var i in propertyGrid.EnumerateItems()) { if (i.Expandable) { yield return(i); } } }
public static GridItem GetGroup(this PropertyGrid propertyGrid, string label) { if (propertyGrid.SelectedGridItem == null) { return(null); } foreach (var i in propertyGrid.EnumerateItems()) { if (i.Expandable && i.Label == label) { return(i); } } return(null); }