public void ExpandBase() { if (_rootExists) { _treeView.ExpandRow(_treeRoot.CurrentPosition, false); } }
void Load(List <NodeInfo> info, TreePosition it) { bool oneSelected = false; var infoCopy = new List <NodeInfo> (info); Dictionary <NodeInfo, TreePosition> nodes = new Dictionary <NodeInfo, TreePosition> (); int num = tree.DataSource.GetChildrenCount(it); for (int n = 0; n < num; n++) { var child = tree.DataSource.GetChild(it, n); object id = tree.DataSource.GetValue(child, idColumn); NodeInfo ni = ExtractNodeInfo(info, id); if (ni != null) { nodes [ni] = child; if (ni.Expanded) { tree.ExpandRow(child, false); } else { tree.CollapseRow(child); } if (ni.Selected) { oneSelected = true; tree.SelectRow(child); } else { tree.UnselectRow(child); } if (ni.ChildInfo != null) { Load(ni.ChildInfo, child); } } } // If this tree level had a selected node and this node has been deleted, then // try to select and adjacent node if (!oneSelected) { // 'info' contains the nodes that have not been inserted if (info.Any(n => n.Selected)) { NodeInfo an = FindAdjacentNode(infoCopy, nodes, info[0]); if (an != null) { it = nodes [an]; tree.SelectRow(it); } } } }