title: How to disable DataGrid automatic resize
body: <p>My <code>&lt;DataGrid&gt;</code> control keeps stretching vertically when I load it with too many items.</p>
  
  <p>How can I keep its original size unchanged? I also have <code>SizeToContent="Height"</code> attribute set on parent <code>&lt;Window&gt;</code>.</p>
  
  <p>Little demo (height should remain same like it was empty):</p>
  
  <p><a href="https://i.stack.imgur.com/pMpQW.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pMpQW.gif" alt="demo"></a></p>
  
  <p>Very simplified XAML snippet which should help you recognize the problem:</p>
  
  <pre><code>&lt;Window SizeToContent="Height"&gt;
  &lt;Grid&gt;
  &lt;Grid.ColumnDefinitions&gt;
      &lt;ColumnDefinition Width="*"/&gt; &lt;!-- First column --&gt;
      &lt;ColumnDefinition Width="*"/&gt; &lt;!-- Second column --&gt;
  &lt;/Grid.ColumnDefintions&gt;
  
  &lt;DataGrid Grid.Column="0"&gt;...&lt;/DataGrid&gt; &lt;!-- Should resize to second column and not get longer when items are added on runtime --&gt; 
  &lt;TextBlock Grid.Column="1" Height="500"/&gt;
  &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>