Click to See Complete Forum and Search --> : bind a treenode text property to a treenode TAG property, Quickly please


naxos
January 3rd, 2003, 02:42 AM
Hey

I have e treeview with a lot of nodes. each node has a tag object. the object has a Name property which set/get a string. Now I want to bind the nodes.Text to the TAG's Name property, but how??? is it possible

MartinL
January 3rd, 2003, 04:40 AM
Yes it is...

Add variable (say ParentNode) which will point to the TreeNode into the class of the object you are assigning to the Tag proprerty of the TreeNode. Initialy set it to null.

Create Name property it that class and during the setting its value set also the Text property of the TreeNode where the ParentNode property points.

Derive your own TreeNodeEx class from the .net framework's TreeNode.

Override property Tag and during the setting that property set also the Text property to the value of the Name property of the object...

Martin