Hi Dmitriy,
Here is some simple implementation of the requested functionality:
1. Disable scrollbars of the NTreeView
treeView.Scrollable = false;
2. Attach to NodeMouseClick event:
treeView.NodeMouseClick += TreeView_NodeMouseClick;
3. In the event handler do the following:
private void TreeView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
NTreeView view = sender as NTreeView;
int lastIndex = view.Nodes.Count - 1;
TreeNode lastNode1stLevel = view.Nodes[lastIndex];
TreeNode lastNode = GetNextVisibleNodeRecursive(lastNode1stLevel);
view.Height = lastNode.Bounds.Bottom;
}
private TreeNode GetNextVisibleNodeRecursive(TreeNode node)
{
TreeNode nextNode = node.NextVisibleNode;
if (nextNode == null)
{
return node;
}
else
{
nextNode = GetNextVisibleNodeRecursive(nextNode);
}
return nextNode;
}
Best Regards,
Nevron Support Team