Saturday, 28 September 2013

TreeView binding from XML by ID

TreeView binding from XML by ID

I'm using WPF.(MVVM pattern) I want to make hierarchical tree using
TreeView. Data from XML. But XML structure is not hierarchical actually.
Nodes binds by ID. XML looks like the following:
<root>
<node>
<Id>1</Id>
<ParentId>-1</ParentId>
<Name>ROOT</Name>
</node>
<node>
<Id>2</Id>
<ParentId>1</ParentId>
<Name>NODE</Name>
</node>
</root>
What should i use to do this? It will be great if you show me any simple
example.
And the second question. How can i get nodes dinamically? That is when i
run the application only root is loading.
Thanks in advance.

No comments:

Post a Comment