Esempio n. 1
0
        private void BuildItems(GridTreeViewItem parentItem, GridViewData data)
        {
            GridTreeViewItem item = new GridTreeViewItem(data);

            if (parentItem.children == null)
            {
                parentItem.children = new List <TreeViewItem>();
            }
            parentItem.children.Add(item);

            if (data.IsExpand)
            {
                if (ViewModel.HasChild(data))
                {
                    foreach (var child in data.Children)
                    {
                        BuildItems(item, child);
                    }
                }
            }
            else
            {
                if (ViewModel.HasChild(data))
                {
                    item.children = TreeView.CreateChildListForCollapsedParent();
                }
            }
        }
Esempio n. 2
0
        protected override IList <TreeViewItem> BuildRows(TreeViewItem root)
        {
            root.children?.Clear();

            GridTreeViewItem rootItem = (GridTreeViewItem)root;

            GridViewData[] childDatas = ViewModel.GetChilds(rootItem.ItemData);
            foreach (var child in childDatas)
            {
                BuildItems(rootItem, child);
            }

            return(base.BuildRows(root));
        }