Click here to Skip to main content
15,038,345 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys
I have a huge problem for 2 weeks now
I am trying to create an application in WPF C# that reads in the xml file and
creates a XMLTreeVview tree. Now I managed to create a binding of my listview Items to the XMLTreeVview tree
but it doesnt have the capability to bind only the SPECIFIC Node Items. Like I have 2 list vies in ListView1 i want only the Folders to be binded and when i click on the specific folder the coresponding ITEMS will be binded twoway to the LISTVIEW2. can anyone please help me im getting readlly frustrated with this issue

here is the C# binding code
ListView2.ItemsSource = xtv.sourceXml.DocumentElement.ChildNodes;

<listview name="ListView2">
         <textbox text="Binding InnerText" />

here is the C# binding code for second ListView
XMLTreeVview  xtv; //this has been returned from the file reader
ListView1.ItemsSource = xtv.sourceXml.DocumentElement.ChildNodes;

<listview name="ListView1">
         <textbox text="Binding FirstChild" />

BUT what i really want here is the List of ONLY the Folders, so when i click on the folder then all the Inner Text/Item will appear in ListView2
Updated 12-Mar-12 4:48am
El_Codero 10-Mar-12 4:31am
Could you please reformat your question? It's hard to read with serveral "XAML Code" and no code provided. Regards


I think you should read following examples from LINQ to XML,
it'll solve your problem quite quickly.[^][^]

Hi thanks for reply but im working on binding a specific items that are located in the folder but i dont see LINQ being able to do this. I have to be able to bind the node in the C# code behind right? where i would use isSelectionChenged event from Listview
André Kraak 10-Mar-12 12:54pm
If you have a question about or comment on a given solution use the "Have a Question or Comment?" option beneath the solution. When using this option the person who gave the solution gets an e-mail message and knows you placed a comment and can respond if he/she wants.

Please move the content of this solution to the solution you are commenting on and remove the solution.
Thank you.
it seems that when i bind the xmlTreeView to the List view I am not able to only bind the Folders. I have used the listView2.ItemsSource to bind my XmlTireeView by type converting it to ListNode then binding it, but when ii try to bind the SubFolders ONLY i can not achive this, I used my treeView
If (xtn.HasChildNode)
ListView2.ItemsSource = xtn.ChildNode;

but fore some reason this Doesnt work
I tried to Extract a layer of the "xtn" sub folders onto another NodeList but I cant parst an XmlTreeview to XmlNodeList

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900