TreeView TreeNodeCollection Key

TreeView uses TreeNodeCollection in its base implementation. A TreeNodeCollection in almost every overload of the add method requests a key.

It also implements indexOfKey and ContainsKey, but there seems to be no way to determine the node key from the node itself or from any of the events that you usually used, such as TreeView_AfterSelect ().

Am I correct, or is it really possible to extract a key from a node or an event that I missed? And I suppose I'm right. Why was this implemented in this way? The only thing I could think of is that maybe TreeNodeCollection.Key is deprecated? But I do not see a mention of this ...

PS: I know the TreeNode.Tag property and how it can be used for the same effect.

+6
c # winforms treeview
source share
1 answer

Take a look here . In the notes you will find the following

The Name property matches the key for the TreeNode in the TreeNodeCollection.

+13
source share

All Articles