title: Bind list to listboxitem in wpf
body: <p>I'm trying to bind a list to a listbox in WPF. But it doesn't seem to work, I just see nothing on screen. </p>
  
  <p>Here is my code:</p>
  
  <p><strong>WPF</strong></p>
  
  <pre><code>&lt;ListBox x:Name="listBox" HorizontalAlignment="Left" Height="453" VerticalAlignment="Top" Width="119" Margin="0,43,0,0" ItemsSource="{Binding orderlist}"&gt;
          &lt;ListBoxItem Content="{Binding orderlist.ID}"&gt;&lt;/ListBoxItem&gt;
      &lt;/ListBox&gt;
  </code></pre>
  
  <p><strong>C#</strong></p>
  
  <pre><code>Order order = new Order();
  Klantgegevens klantgegevens = new Klantgegevens();
              XmlReader rdr = XmlReader.Create(@"C:\Users\Gebruiker\Desktop\EDI\Rekening.xml");
              rdr.ReadToFollowing("datum");
              order.DatumOntvangst = rdr.ReadElementContentAsString();
              rdr.ReadToFollowing("volgnr");
              order.Status = "Aangenomen";
              order.Opmerkingen = "";
              rdr.ReadToFollowing("naam");
              order.Afzender = rdr.ReadElementContentAsString();
              rdr.ReadToFollowing("naam");
              klantgegevens.Naam = rdr.ReadElementContentAsString();
              rdr.ReadToFollowing("straat");
              klantgegevens.Straat = rdr.ReadElementContentAsString();
              rdr.ReadToFollowing("huisnr");
              klantgegevens.Huisnummer = rdr.ReadElementContentAsInt();
              rdr.ReadToFollowing("plaats");
              klantgegevens.Woonplaats = rdr.ReadElementContentAsString();
              rdr.ReadToFollowing("postcode");
              klantgegevens.Postcode = rdr.ReadElementContentAsString();
              rdr.ReadToFollowing("telefoonnr");
              klantgegevens.Telefoonnummer = rdr.ReadElementContentAsString();
              order.Klantgegevens = klantgegevens;
              orderlist.Add(order);
              listBox.DataContext = orderlist;
  </code></pre>
  
  <p>As you probably know, Order is a custom class, and so is Klantgegevens.
  I'm pretty new to binding and WPF in general so excuse me for my stupidness :)</p>