///
/// Copyright © 2003-2008 JetBrains s.r.o.
/// You may distribute under the terms of the GNU General Public License, as published by the Free Software Foundation, version 2 (see License.txt in the repository root folder).
///
using System;
using System.Windows.Forms;
namespace JetBrains.UI.Components.CustomTreeView
{
///
/// Controls selection of a tree view
///
public class SelectionController
{
///
/// The tree view to use
///
private TreeView myTreeView;
public SelectionController( TreeView treeView )
{
myTreeView = treeView;
}
public static void SelectDeepestVisible( TreeNode node )
{
while (node.IsExpanded && node.Nodes.Count > 0)
node = node.Nodes[0];
node.TreeView.SelectedNode = node;
node.Collapse();
}
}
}