Expanding TreeView Nodes
Posted on 2005-04-13
I am currently writing a custom control for a project that emulates windows explorer. This control has a TreeView which contains the folder structure of the system. Instead of loading each and every one of the file systems folders into this TreeView at startup, I have it so that when a node is clicked, it automatically creates child nodes from that nodes path (the path being contained in the nodes tag). I am using the AfterSelect event of the tree view to handle this operation.
The problem I am having is when I click on the Plus sign next to a node and expand it, my method for adding sub directories to that node does not fire off. If I actually select the node's icon (or text), it works just fine. I have tried using the AfterExpand event in addition to AfterSelect, but no dice. I even tried using BeforeSelect and BeforeExpand, but no dice there either.
Does anyone have any suggestions on how I can get the TreeView to respond when I expand a node? I'm sure it's easy, but I'm at a loss here. I hope this makes sense.