title: Parsed XML to Listbox
body: <p>I've already did a similar thing with this simple code:</p>
  
  <pre><code> var data = from query in xml.Descendants("item")
                     select new Object
                     {
                         Element = (string)query.Element("element"),
                     };
          listBox.ItemsSource = data;
  </code></pre>
  
  <p>But I had to deal also with a nested XML so I was worried that the code wouldn't have worked with that file, so I followed this topic <a href="https://stackoverflow.com/questions/14783406/deserializing-nested-xml-into-c-sharp-objects">Deserializing nested xml into C# objects</a> and now I don't know how to show the datas in a listbox.</p>
  
  <p>I use this class to serialize the XML:</p>
  
  <pre><code>{
  [XmlRoot("contacts")]
  
  public class Contacts
  {
      [XmlElement("building")]
      public Building[] BuildingList { get; set; }
  
  }
  
  public class Building
  {
      [XmlElement("name")]
      public string Name { get; set; }
  
      [XmlElement("address")]
      public string Address { get; set; }
  
      [XmlElement("tel")]
      public string Tel { get; set; }
  
      [XmlElement("email")]
      public string Email { get; set; }
  
      [XmlElement("link")]
      public string Link { get; set; }
  
      [XmlElement("timing")]
      public string Timing { get; set; }
  
      [XmlArray("contacts"), XmlArrayItem("contact")]
      public Contact[] ContactList { get; set; }
  }
  
  [XmlRoot("contact")]
  public class Contact
  {
      [XmlElement("surname")]
      public string Surname { get; set; }
  
      [XmlElement("name")]
      public string Name { get; set; }
  
      [XmlElement("area")]
      public string Area { get; set; }
  
      [XmlElement("role")]
      public string Role { get; set; }
  
      [XmlElement("tel")]
      public string Tel { get; set; }
  
      [XmlElement("email")]
      public string email { get; set; }
  }
  </code></pre>
  
  <p>This is my listbox:</p>
  
  <pre><code>&lt;ListBox x:Name="listBox_buildings"&gt;
                  &lt;ListBox.ItemTemplate&gt;
                      &lt;DataTemplate&gt;
                          &lt;StackPanel VerticalAlignment="Top"&gt;
                              &lt;TextBlock  x:Name="text_title" Foreground="Black" FontSize="25"  TextWrapping="Wrap" HorizontalAlignment="Stretch" Text="{Binding Name}"/&gt;
                          &lt;/StackPanel&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/ListBox.ItemTemplate&gt;
  </code></pre>
  
  <p>Anybody has some clues? Thanks</p>