I have a problem concerning good application design that has been keeping me up for days now. One can describe it as:
- I have a tree structure made up of Nodes holding references to their children.
- I would now like to display that structure in a TreeView (I am the one who will implement the TreeView).
- I don’t want the Nodes to ‘know’ that there is a TreeView, enabling me to keep those two components separate.
So where do I store the information whether an node is expanded or not (this information is not part of the Node itself).
Any idea on how to implement this in a clean way?
Thanks,
Konne
Create a TreeViewModal class that binds the view and the actual modal. Apparently this is known as Model/View/ViewModel pattern. Here is an example for the TreeView. Both the links has code in C# but it is easy to port to any language.