title: Changing a DataGrid's column width
body: <p>I'd like to change a DataGrid's column width, but I keep receiving an error.</p>
  
  <p>This is how I fill in the DataGrid:</p>
  
  <pre><code>tabel.ItemsSource = Item.getItemByCategory(category).DefaultView;
  </code></pre>
  
  <p><code>getItemByCategory</code> is a static method of the <code>Item</code> class which return a <code>DataTable</code>.</p>
  
  <p>This is how I try to resize the column:</p>
  
  <pre><code>tabel.Columns[1].Width = 100;
  </code></pre>
  
  <p>And this is the error I receive:</p>
  
  <blockquote>
    <p>Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index</p>
  </blockquote>
  
  <p>For some reason, <code>tabel.Columns.Count == 0</code>. Although immediately after it is being shown there are 4 column displayed.</p>
  
  <p>Could I get some help in resizing the columns?</p>