Tree View Question
-
I have a class: class DBdata { public int id; public int name; public int email blah blah blah } This class correlates to a table in the database, as you could probably tell. I want to show this in Tree View where for example the name is the actually text of the node but the id and email are also encapsulates parts or that data, so that is to say if a drag one node from one tree to the another tree view it will cary its data with it. How can i do this because in a tree view I cant add any object unless it is of type TreeNode.
-
I have a class: class DBdata { public int id; public int name; public int email blah blah blah } This class correlates to a table in the database, as you could probably tell. I want to show this in Tree View where for example the name is the actually text of the node but the id and email are also encapsulates parts or that data, so that is to say if a drag one node from one tree to the another tree view it will cary its data with it. How can i do this because in a tree view I cant add any object unless it is of type TreeNode.
Either make the Tag property of each TreeNode in the TreeView point to an instance of DBdata, or create a TreeNode-derived class that exposes it (and then only add instances of the derived node to the tree). The first option is probably sufficient.
:josh: My WPF Blog[^]