I currently have a data structure that displays file system tree's its basically an object with an array list of like typed objects. I want to display this in a treeview, and need to run some code when the tree view nodes are expanded, collapsed, selected, etc.
My question- is there a design pattern, or method of coupling between the data structure and the treeview that wont require me to search the whole DS tree for the selected node each time the user selects something?
Currently I am searching the data structure for a node with the same Text and Tag property as the selected node each time a relevant tree view event fires. I run into scenarios where if the node is not a leaf I have to go and re-search for its parent node, and I'm concerned about performance with large tree
Keep in mind, the data structure already inherits an object so I cant simply extend the treenode class.
Any help is greatly appreciated