title: How to make the last DataGrid's column occupy the whole left space?
body: <p>First!
  I know it can seem a kind of <a href="https://stackoverflow.com/questions/4389630/how-to-make-the-last-column-in-wpf-datagrid-take-all-the-left-space-always">dup</a> nevertheless it isn't.</p>
  
  <p>I have a grid as a data template for <code>DataGrid.RowDetails</code>.
  It has three columns: two with <code>Width="Auto"</code> and the 3d with <code>Width="*"</code></p>
  
  <pre><code>&lt;DataTemplate x:Key="NotEmptyDistributionsTemplateKey"&gt;
      &lt;DataGrid ItemsSource="{Binding SoftwareVersionDistributions}"
          CanUserAddRows="False"
          CanUserDeleteRows="False"
          CanUserReorderColumns="False"
          CanUserResizeColumns="True"
          CanUserSortColumns="False"
          IsReadOnly="True"
          CanUserResizeRows="False"
          AutoGenerateColumns="False"
          RowHeaderWidth="0"
          Margin="20,5"
          HorizontalAlignment="Stretch"&gt;
          &lt;DataGrid.Columns&gt;
              &lt;DataGridTextColumn 
                  Header="Architecture" 
                  Binding="{Binding SoftwareArchitecture.Name, TargetNullValue=Все, FallbackValue=Все}"
                  Width="Auto"/&gt;
              &lt;DataGridTextColumn 
                  Header="Language" 
                  Binding="{Binding SysCodepage.Title, TargetNullValue=Все, FallbackValue=Все}" 
                  Width="Auto"/&gt;
              &lt;DataGridHyperlinkColumn 
                  Header="Link" 
                  Binding="{Binding DownloadLink}"
                  Width="*" 
                  CanUserResize="False"/&gt;
          &lt;/DataGrid.Columns&gt;
      &lt;/DataGrid&gt;
  &lt;/DataTemplate&gt;
  </code></pre>
  
  <p>This template shows exactly 3 columns, if Grid is nested in a cell.
  But when it is used as <code>RowDetaislTemplate</code> 4th empty column appears.
  This makes me mad.</p>
  
  <p>Does anybody have ideas why this can happen?</p>
  
  <p><strong>Update 1</strong>. How it looks:</p>
  
  <p><img src="https://i.stack.imgur.com/cvVz0.png" alt="enter image description here"></p>
  
  <p><strong>Update 2</strong>.</p>
  
  <p>Finally I found the soultion. Just added <code>ScrollViewer.HorizontalScrollBarVisibility="Disabled"</code></p>
  
  <p>Now it's ok:</p>
  
  <p><img src="https://i.stack.imgur.com/rRO8Q.png" alt="enter image description here"></p>
  
  <p>But I cannot understand this odd behavior.</p>
  
  <p><strong>Update 3</strong> (may be helpful to someone)</p>
  
  <p>Recently we've found a bug which our users had and the developers did not. The bug was again about DataGrid's width and alignment. Well, may be this was not really a bug, but we had different behavior of the control.<br/>
  The research revealed that when installing .net framework 4.5 installer also updated .net framework 4.0. This update changed somehow DataGrid's behavior. (to the expected one)<br/>
  We asked our users to install framework 4.5 and the problem dissapeared. Though our app still targets .net 4.0</p>