PandaNL
PandaNL

Reputation: 848

Refresh a treeview and expand last selected node

In my application i copy a certain pdf file to the selected node, after this i want the treeview to refresh and show me the added file.

The refresh is working but it won't expand the last selected node.

How can i do a refresh but still keep the last selected node expanded, so the user can see that the pdf file is added to the folder.

enter image description here

Upvotes: 2

Views: 6450

Answers (1)

Jaques
Jaques

Reputation: 2287

The AfterSelect on the TreeView have a parameter TreeViewEventArgs e. e.Node will return the selected node. eg:

e.Node.Expand();

or

e.Node.ExpandAll();

Should you wish to expand all the nodes in the treeview. You can use the same method to expand the

I assume that you know which node you have copied it too. Use the same method to expand the node you've copied too.

Upvotes: 4

Related Questions