Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get the expanding node in a treeview

Tags:

c#

treeview

I have a treeview control that functions like a folder browser. Because loading the entire folder structer from disk is taking a lot of time i'm trying to load only one level at a time. So i have a function that adds nodes for all the folders in the current node.

I thought that the best method would be to run it on the BeforeExpand event of the treeview.

UpdateTreeView(TreeView.SelectedNode);

is not working because clicking the + sign to expand is not selecting the node also.

So how to find the node that is expanding.

like image 809
Iulian Avatar asked Apr 15 '10 11:04

Iulian


1 Answers

The BeforeExpand event should work. It has a TreeViewCancelEventArgs which contains a Node property. It is essentially the node being expanded.

like image 175
Petar Minchev Avatar answered Sep 30 '22 12:09

Petar Minchev