public void AddBranchAndChildren(TreeViewItem parent, ROMNode node) { string caption = node.GetROMObjectID(); TreeViewItem current = null; if (parent != null) { current = new TreeViewItem(); current.Header = caption; current.Tag = node; current.Name = "_" + node.GetROMGUID().Replace('-', '_'); try { treeCtrl.UnregisterName(current.Name); } catch { } treeCtrl.RegisterName(current.Name, current); parent.Items.Add(current); } ROMNode[] children = node.GetAllChildren(false); if (children != null) { foreach (ROMNode child in children) { AddBranchAndChildren(current, child); } } }
public void BuildTree() { treeCtrl.Items.Clear(); string caption = m_rootNode.GetROMObjectID(); TreeViewItem current = new TreeViewItem(); current.Header = caption; current.Tag = m_rootNode; current.Name = "_" + m_rootNode.GetROMGUID().Replace('-', '_'); try { treeCtrl.UnregisterName(current.Name); } catch { } treeCtrl.RegisterName(current.Name, current); current.IsSelected = true; treeCtrl.Items.Add(current); ROMNode[] children = m_rootNode.GetAllChildren(false); if (children != null) { foreach (ROMNode child in children) { AddBranchAndChildren(current, child); } } }
public void AddBranchAndChildren(TreeViewItem parent, ROMNode node) { string caption = node.GetROMObjectID(); TreeViewItem current = null; if (parent != null) { current = new TreeViewItem(); current.Header = caption; current.Tag = node; current.Name = "_" + node.GetROMGUID().Replace('-', '_'); try { treeCtrl.UnregisterName(current.Name); } catch { } treeCtrl.RegisterName(current.Name, current); parent.Items.Add(current); } ROMNode[] children = node.GetAllChildren(false); if (children != null) foreach (ROMNode child in children) { AddBranchAndChildren(current, child); } }