title: Bind ListBox to XmlDocument
body: <p>Could someone help me out, to why my listbox is empty?</p>
  
  <p>The XmlDocument contains the following XML:</p>
  
  <pre><code>&lt;Config&gt;
    &lt;Tabs&gt;
      &lt;Tab Name="Test1" /&gt;
      &lt;Tab Name="Test2" /&gt;
    &lt;/Tabs&gt;
  &lt;/Config&gt;
  </code></pre>
  
  <p>In my XAML file I have tried the following</p>
  
  <pre><code>&lt;Window&gt;
    &lt;Grid&gt;
       &lt;ListBox DataContext="{Binding {StaticResource Data}, XPath=//Tabs}" ItemsSource="{Binding XPath=Tab/@Name}"&gt;
       &lt;/ListBox&gt;
    &lt;/Grid&gt;
  &lt;Window&gt;
  </code></pre>
  
  <p>I know I haven't set up the binding to name attribute but shouldn't this display XmlDocument.XmlNode.ToString() for each Tab Node if it was working?</p>
  
  <p>My C# Constructor Code behind:</p>
  
  <pre><code>InitializeComponent();
  this.doc = new XmlDocument();
  doc.LoadXml(config.document.OuterXml);
  XmlDataProvider provider = (XmlDataProvider)Resources["Data"];
  provider.Document = doc;
  provider.Refresh();
  </code></pre>
  
  <p>With <code>config.document.OuterXml</code> being a valid document containing the above xml.</p>
  
  <p>I got this working with procedural code using Collections, but I have been trying to figure out how to bind directly to XML.  </p>
  
  <p>Update: ListBox empty</p>
  
  <p>Now there is no binding errors, but my listbox is coming up empty, I have double checked my XML file, and even did MessageBox.Show(provider.Document.OuterXML) and can confirm that the XmlDocument does have the correct nodes.</p>
  
  <p>Thanks in advance</p>