/// <summary> /// Performs the default action, which is either collapsing or expand the tree node /// </summary> public override void DoDefaultAction() { if (node.IsExpanded) { node.Collapse(); } else { node.Expand(); } }
public void EnsureVisible2() { TreeNodeAdv parent = this.Parent; while (parent != _tree.Root) { parent.Expand(); parent = parent.Parent; } _tree.ScrollTo2(this); }
/// <summary> /// Either selects or focuses the tree node. /// </summary> /// <param name="flags">either select or focus.</param> public override void Select(AccessibleSelection flags) { if ((flags & AccessibleSelection.TakeSelection) > 0) { node.Tree.SelectedNode = node; } else if ((flags & AccessibleSelection.TakeFocus) > 0) { TreeNodeAdv parent = node.Parent; while (parent != null) { if (!parent.IsExpanded) { parent.Expand(); } parent = parent.Parent; } node.Tree.ScrollTo(node); node.Tree.Focus(); } }
private static void Expand(TreeNodeAdv node) { // Loop through all parent nodes that are not already // expanded and expand them. if (node.Parent != null && !node.Parent.IsExpanded) Expand(node.Parent); node.Expand(); }