title: I want to display data from a xml into a grid
body: <p>I want to display data from a xml into a grid</p>
  
  <p>The values ​​I need I get this foreach:</p>
  
  <pre><code>foreach (XElement wid in document.Root.Elements("widget"))
      {
                  MessageBox.Show(wid.Attribute("caption").Value); //variable: nombreWidget 
  
          foreach (XElement service in wid.Elements("service"))
                  {
                      MessageBox.Show(service.Attribute("caption").Value); //variable: nombreServicio 
                      MessageBox.Show(service.Element("xvalue").Value); //variable: valor 
                  }
       }
  </code></pre>
  
  <p>Manually introduce values ​​to variables that I fill in:</p>
  
  <pre><code>public class Widgets
  {
      public Widgets()
      {
  
          Items = new ObservableCollection&lt;WidgetCollectionItem&gt;
              {
                  new WidgetCollectionItem
                      {
                          nombreWidget = "Widget", nombreServicio = "Servicio", valor = "valor"
                      },
          new WidgetCollectionItem
                      {
                          nombreWidget = "Widget2", nombreServicio = "Servicio2", valor = "valor2"
                      },
              };
      }
      public ObservableCollection&lt;WidgetCollectionItem&gt; Items { get; set; }
  }
  
  
  public class WidgetCollectionItem
  {
      public string nombreWidget { get; set; }
      public string nombreServicio { get; set; }
      public string valor { get; set; }
  }
  </code></pre>
  
  <p>But what I want to achieve is to enter the data foreach in  ObservableCollection</p>
  
  <p>I try to mix the two, entering the foreach after ObservableCollection ,to tour and enter data, but does not work.</p>
  
  <p>What is the solution?</p>