title: WPF Full width DataGridColumn on DataGrid's width
body: <p>I have a <strong>WPF</strong> <code>Window</code> with a <code>DataGrid</code> inside a <code>Grid</code> like this:</p>
  
  <pre><code>&lt;Window x:Class="WpfApplication1.MainWindow"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          Title="MainWindow" SizeToContent="WidthAndHeight" WindowStyle="ToolWindow" ResizeMode="NoResize"&gt;
      &lt;Grid&gt;
          &lt;Grid.ColumnDefinitions&gt;
              &lt;ColumnDefinition Width="Auto"/&gt;
          &lt;/Grid.ColumnDefinitions&gt;
  
          &lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition Height="Auto"/&gt;
              &lt;RowDefinition Height="Auto"/&gt;
          &lt;/Grid.RowDefinitions&gt;
  
          &lt;TextBlock FontSize="20"&gt;Some header with some pretty longish text&lt;/TextBlock&gt;
  
          &lt;DataGrid Grid.Row="1" Height="200"&gt;
              &lt;DataGrid.Columns&gt;
                  &lt;DataGridTextColumn Header="Column1" Width="*"/&gt;
              &lt;/DataGrid.Columns&gt;
          &lt;/DataGrid&gt;
  
      &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>I'd like the <code>DataGrid</code>'s width to be at least the width of the <code>TextBlock</code>, which in this case is, because of the <code>Grid</code>'s <code>ColumnDefinition</code>'s width set to <code>Auto</code>.</p>
  
  <p>But somehow, the width of the <code>DataGrid</code>'s <code>Column</code> is at a minimum (and can't even be resized), while I expect it's width to be filled. Currently it looks like this:<br>
  <a href="https://i.stack.imgur.com/6LtEt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6LtEt.png" alt="enter image description here"></a></p>
  
  <p>Note that the window has to be a <code>ToolWindow</code> and it's <code>SizeToContent</code> set to <code>WidthAndHeight</code>.</p>