title: Binding XML data to WPF treeview Control
body: <p>I have spend a lot of time trying to figure out how to bind data in my XML file to the TreeView control but I do not know where to start. I even tried going through <a href="https://stackoverflow.com/questions/188001/two-way-binding-of-xml-data-to-the-wpf-treeview">Two-way binding of Xml data to the WPF TreeView</a> and Josh Smith's code sample on codeproject, but still can't understand how to begin!!!</p>
  
  <p>I have XML in in a file "C:\SPDependencies.xml" (I can change the format if required)!!!:</p>
  
  <pre><code>  &lt;node type="SPDependencies" Name="SPDependencies"&gt;
          &lt;node type="StoredProc" Name="SP1"&gt;
                  &lt;node type="OperationType" Name="Type1"&gt;
                          &lt;node type="TableName" Name="Table1"/&gt;
                          &lt;node type="TableName" Name="Table2"/&gt;
                  &lt;/node&gt;
                  &lt;node type="OperationType" Name="Type2"&gt;
                           &lt;node type="TableName" Name="Table1"/&gt;
                          &lt;node type="TableName" Name="Table2"/&gt;
                  &lt;/node&gt;
                   .....
          &lt;/node&gt;
          &lt;node type="StoredProc" Name="SP2"&gt;
                &lt;node type="OperationType" Name="Type1"&gt;
                ...
                ...
          &lt;/node&gt;
  &lt;/node&gt;
  </code></pre>
  
  <p>I need to display this in the Treeview control in the following format:</p>
  
  <pre><code>&lt;SP1&gt;
     &lt;Type1&gt;
        &lt;Table1&gt;
        &lt;Table2&gt;
        &lt;Table3&gt;
     &lt;Type2&gt;
        &lt;Table1&gt;
        &lt;Table2&gt;
        &lt;Table3&gt;
  &lt;SP2&gt;
      &lt;Type1&gt;
  ........
  </code></pre>
  
  <p>Thanks,
  Abhi.</p>