public static IEnumerable <GridItem> EnumerateAllItems(this PropertyGrid grid)
        {
            if (grid == null)
            {
                throw new ArgumentException();
            }

            // get to root item
            GridItem start = grid.SelectedGridItem;

            while (start.Parent != null)
            {
                start = start.Parent;
            }

            return(start.EnumerateAllItems());
        }
        public static IEnumerable <GridItem> EnumerateAllItems(this PropertyGrid grid)
        {
            if (grid == null)
            {
                yield break;
            }

            // get to root item
            GridItem start = grid.SelectedGridItem;

            while (start.Parent != null)
            {
                start = start.Parent;
            }

            foreach (GridItem item in start.EnumerateAllItems())
            {
                yield return(item);
            }
        }