Beispiel #1
0
        public static IEnumerable <TreeListViewItem> EnumerateItems(this TreeListView tv,
                                                                    Func <TreeListViewItem, bool> walkChildren)
        {
            foreach (var item in tv.Items)
            {
                var tvi = (TreeListViewItem)tv.ItemContainerGenerator.ContainerFromItem(item);
                if (tvi != null)
                {
                    yield return(tvi);

                    if (walkChildren(tvi))
                    {
                        foreach (var sub in EnumerateChildren(tvi, walkChildren))
                        {
                            yield return(sub);
                        }
                    }
                }
            }
        }
Beispiel #2
0
 public static IEnumerable <TreeListViewItem> EnumerateItems(this TreeListView tv)
 {
     return(EnumerateItems(tv, item => true));
 }