title: Programmatically add new row to WPF DataGrid
body: <p>I'm trying to add new rows to a DataGrid on a WPF application when clicking on a specific button.
  This is what I tried so far:</p>
  
  <pre><code>DataGridRow row = new DataGridRow();
  table.Items.Add(row); // table = my DataGrid
  </code></pre>
  
  <p>When I run this code, it throws a <code>System.ArgumentNullException</code> saying </p>
  
  <blockquote>
    <p>Value cannot be null</p>
  </blockquote>
  
  <p>What should I do to solve this problem?
  Thanks in advance.</p>