Вопрос

I'm building an application with the .NET Compact Framework v3.5 with C# using Visual Studio 2008. The OS is Windows Mobile 6.5.3

For listing articles I want to use a TreeView, but I can't figure out how to give the node its own identifier. This is how it'll be displayed:

-Article
---Part
---Part
-Article
---Part
-Article
---Part
---Part

I've seen examples that set the name attribute of the treenode, but apparently that doesn't exist in this framework.

I also can't display the identifier in the value attribute, because it displays other information.

So my question is: how can I search for the right treenode in the treeview when using the identifier?

Cheers.

Это было полезно?

Решение

You can use the TreeNode's Tag property to store/associate any information you would like about each node.

TreeNode.Tag Property

Gets or sets the object that contains data about the tree node.

When you search the tree you cast your object from the Tag property of the node and perform your business logic.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top