private static void SetChildren(TreeViewItem item, List <TreeViewItem> newChildList) { if (LazyTreeViewDataSource.IsChildListForACollapsedParent(item.children) && newChildList == null) { return; } item.children = newChildList; }
private void AddVisibleChildrenRecursive(BackendData.Foo source, TreeViewItem dest) { if (this.IsExpanded(source.id)) { if (source.children != null && source.children.Count > 0) { dest.children = new List <TreeViewItem>(source.children.Count); for (int i = 0; i < source.children.Count; i++) { BackendData.Foo foo = source.children[i]; dest.children.Add(new FooTreeViewItem(foo.id, dest.depth + 1, dest, foo.name, foo)); this.itemCounter++; this.AddVisibleChildrenRecursive(foo, dest.children[i]); } } } else if (source.hasChildren) { dest.children = LazyTreeViewDataSource.CreateChildListForCollapsedParent(); } }