title: Resize DataGrid Column OnLoaded programmatically
body: <p>I have this DataGrid which looks like this when I load data for the first time:
  <a href="https://i.stack.imgur.com/eOZZh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eOZZh.png" alt="enter image description here"></a></p>
  
  <p>so, its almost perfect but what I really want is shown when I resize the Window to maximum - the columns are now layouted like this:
  <a href="https://i.stack.imgur.com/Y3IB5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Y3IB5.png" alt="enter image description here"></a></p>
  
  <p>I would like to layout the right most columns at the right part of the DataGrid view and have the left column allocate the rest of the view.</p>
  
  <p>My question is: Can I invoke an event on the DataGrid to cause this layouting of the columns that would otherwise only occur when the Window is maximized?</p>
  
  <p>The simplified version of the DataGrid's XAML looks like this:</p>
  
  <pre><code>&lt;DataGrid
     ItemsSource="{Binding ItemsSource, RelativeSource={RelativeSource TemplatedParent}}"
     HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
     ScrollViewer.HorizontalScrollBarVisibility="Hidden" 
     ScrollViewer.VerticalScrollBarVisibility="Auto" 
     ScrollViewer.CanContentScroll="True"
     AutoGenerateColumns="False"
     GridLinesVisibility="None"
     ColumnWidth="*"&gt;
     &lt;DataGrid.Columns&gt;
         &lt;DataGridTemplateColumn Width="*" Header="Name"&gt;
             &lt;DataGridTemplateColumn.CellTemplate&gt;
                 &lt;DataTemplate&gt;
                     &lt;Grid&gt;
                         &lt;Grid.ColumnDefinitions&gt;
                             &lt;ColumnDefinition Width="Auto"/&gt;
                             &lt;ColumnDefinition Width="*"/&gt;
                         &lt;/Grid.ColumnDefinitions&gt;
  
                         &lt;TextBlock Grid.Column="1"
                                    Text="{Binding ItemName}"
                                    ToolTipService.ShowOnDisabled="true"
                                    &gt;
                          &lt;/TextBlock&gt;
                     &lt;/Grid&gt;
                 &lt;/DataTemplate&gt;
             &lt;/DataGridTemplateColumn.CellTemplate&gt;
         &lt;/DataGridTemplateColumn&gt;
         &lt;DataGridTemplateColumn Width="Auto" Header="Size"&gt;
             &lt;DataGridTemplateColumn.CellTemplate&gt;
                 &lt;DataTemplate&gt;
                     &lt;TextBlock
                         Text="{Binding ItemLengthA}"
                                HorizontalAlignment="Right"
                                Margin="3,0,0,0"
                     /&gt;
                 &lt;/DataTemplate&gt;
             &lt;/DataGridTemplateColumn.CellTemplate&gt;
         &lt;/DataGridTemplateColumn&gt;
         &lt;DataGridTemplateColumn Width="Auto" Header="Modified"&gt;
             &lt;DataGridTemplateColumn.CellTemplate&gt;
                 &lt;DataTemplate&gt;
                     &lt;TextBlock
                         Text="{Binding ItemLastUpdateA}"
                         HorizontalAlignment="Right"
                         Margin="3,0,0,0"
                     /&gt;
                 &lt;/DataTemplate&gt;
             &lt;/DataGridTemplateColumn.CellTemplate&gt;
         &lt;/DataGridTemplateColumn&gt;
     &lt;/DataGrid.Columns&gt;
  &lt;/DataGrid&gt;
  </code></pre>
  
  <p>I also have working application/control to inspect <a href="https://github.com/Dirkster99/Aehnlich/blob/master/source/AehnlichViewLib/Controls/DiffDirView.xaml" rel="nofollow noreferrer">here</a> but I think looking at the above XAML should be enough to find a solution based on the given layout.</p>