Programmatically binding xml document to treeview in WPF

d1alac

New Member
I've been doing some search on google and reading some similar questions here on SO but haven't found the answer to my question yet. I am binding an xml file to a treeview control in WPF. Using this article I am easily able to set up 2-way databinding with my xml file. However, I would like to apply sorting to my xml document before I attach it. I am modelling a task organizer in which tasks contain start dates and due dates and I would like to order nodes by pending due date so the most urgent tasks appear first. I have some experience with Linq to XML but am not sure how to approach the binding issue. Any thoughts?So after some more reading here is my pseudo code:
  • Create an XDocument from my local XML file
  • Sort the XDocument based on the tasks due date
  • Create a new XmlDataProvider from the newly sorted XDocument
  • Bind it to the TreeView
Can anyone help me flush this out?
 
Back
Top