title: Designing my models for binding to DataGrid items and headers
body: <p>I'm trying to obtain a DataGrid in my View from some DATA in my Model. I think i must reorganize the DATA in my ViewModel to display them in my View.
  I'm new in MVVM and I'd like to understand 2 points of the question:</p>
  
  <ol>
  <li>Taking in mind that I do not know neither the number of the rows, neither the number of the columns, what kind of data holder i should use? ObservableCollection&lt;>?
  More in detail each row will have an item, and each column will have an aspect of the item.</li>
  <li>How can I set the Headers of my DataGrid?</li>
  </ol>
  
  <p>The rows should apperar like 1,2,3...
  The columns should have their specific names.</p>
  
  <p>This is my try:</p>
  
  <p>MainWindow.xaml:</p>
  
  <pre><code>&lt;DataGrid AutoGenerateColumns="false" ItemsSource="{Binding MyTable}" /&gt;
  </code></pre>
  
  <p>MainWindowViewModel.cs:</p>
  
  <pre><code>private ObservableCollection&lt;List&lt;MyItem&gt;&gt; _myTable;
  public class MyItem
  {
      public MyItem(string value)
      {
          Value= value;
      }
      public string Value{ get; set; }
  }
  public ObservableCollection&lt;List&lt;MyItem&gt;&gt; MyTable
  {
      get
      {
          return _myTable;
      }
  
      set
      {
          _myTable = value;
          RaisePropertyChanged("MyTable");
      }
  }
  </code></pre>
  
  <p>The execute of the comand is:</p>
  
  <pre><code>private void DisplayDataTableExecute()
      {
          MyTable = new ObservableCollection&lt;List&lt;MyItem&gt;&gt;();
          var temp = new List&lt;MyItem&gt;();
          temp.Add(new MyItem("one"));
          temp.Add(new MyItem("two"));
          temp.Add(new MyItem("three"));
          MyTable.Add(temp);
          temp = new List&lt;MyItem&gt;();
          temp.Add(new MyItem("ONE"));
          temp.Add(new MyItem("TWO"));
          temp.Add(new MyItem("THREE"));
          MyTable.Add(temp);
      }
  </code></pre>
  
  <p>When i use the AutoGenerateColumns="false" I only see some rows (the correct number but empty) when i use the AutoGenerateColumns="true" i see the properties of the table (Capacity and Count).</p>
  
  <p>I really need some help, because i can't find a solution.</p>