문제

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