title: C# WPF Resizing Controls In Grid Row to Fill All Width
body: <p>I am trying to have my ComboBox stretch to use all empty space in the expanded window. If the window's width were to shrink, the ToolBarTray will collapse.</p>
  
  <p>I used a grid with 2 columns with width specified as * &amp; 300 respectively.
  How can the ComboBox be made to fill all available space in the row?</p>
  
  <p><a href="https://i.stack.imgur.com/4vURK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4vURK.png" alt="Expanded window"></a>
  <a href="https://i.stack.imgur.com/CZexZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CZexZ.png" alt="Collapsed window"></a></p>
  
  <pre><code>&lt;Grid&gt;
      &lt;Grid.RowDefinitions&gt;
          &lt;RowDefinition Height="50" /&gt;
      &lt;/Grid.RowDefinitions&gt;
  
      &lt;DockPanel LastChildFill="True" Grid.Row="0"&gt;
          &lt;Grid DockPanel.Dock="Top"&gt;
              &lt;Grid.ColumnDefinitions&gt;
                  &lt;ColumnDefinition Width="*" /&gt;
                  &lt;ColumnDefinition Width="300" /&gt;
              &lt;/Grid.ColumnDefinitions&gt;
  
              &lt;ToolBarTray DockPanel.Dock="Left"&gt;
                  &lt;ToolBar Name="Standard"&gt;
                      &lt;Button Height="32"&gt;
                          &lt;StackPanel Orientation="Horizontal" Margin="5,0,5,0" HorizontalAlignment="Right"&gt;
                              &lt;Image Height="24" Width="24" HorizontalAlignment="Center" Source="Images/document.png" /&gt;
                          &lt;/StackPanel&gt;
                      &lt;/Button&gt;
  
                      &lt;Button Height="32"&gt;
                          &lt;StackPanel Orientation="Horizontal" Margin="5,0,5,0" HorizontalAlignment="Right"&gt;
                              &lt;Image Height="24" Width="24" HorizontalAlignment="Center" Source="Images/document.png" /&gt;
                          &lt;/StackPanel&gt;
                      &lt;/Button&gt;
  
                      &lt;Button Height="32"&gt;
                          &lt;StackPanel Orientation="Horizontal" Margin="5,0,5,0" HorizontalAlignment="Right"&gt;
                              &lt;Image Height="24" Width="24" HorizontalAlignment="Center" Source="Images/document.png" /&gt;
                          &lt;/StackPanel&gt;
                      &lt;/Button&gt;
                  &lt;/ToolBar&gt;
  
                  &lt;ToolBar Name="Standard2"&gt;
                      &lt;Button Height="32"&gt;
                          &lt;StackPanel Orientation="Horizontal" Margin="5,0,5,0" HorizontalAlignment="Right"&gt;
                              &lt;Image Height="24" Width="24" HorizontalAlignment="Center" Source="Images/document.png" /&gt;
                          &lt;/StackPanel&gt;
                      &lt;/Button&gt;
  
                      &lt;Button Height="32"&gt;
                          &lt;StackPanel Orientation="Horizontal" Margin="5,0,5,0" HorizontalAlignment="Right"&gt;
                              &lt;Image Height="24" Width="24" HorizontalAlignment="Center" Source="Images/document.png" /&gt;
                          &lt;/StackPanel&gt;
                      &lt;/Button&gt;
  
                      &lt;Button Height="32"&gt;
                          &lt;StackPanel Orientation="Horizontal" Margin="5,0,5,0" HorizontalAlignment="Right"&gt;
                              &lt;Image Height="24" Width="24" HorizontalAlignment="Center" Source="Images/document.png" /&gt;
                          &lt;/StackPanel&gt;
                      &lt;/Button&gt;
                  &lt;/ToolBar&gt;
              &lt;/ToolBarTray&gt;
  
              &lt;ComboBox Grid.Column="1" MinWidth="200" &gt;&lt;/ComboBox&gt;
          &lt;/Grid&gt;
      &lt;/DockPanel&gt;
  &lt;/Grid&gt;
  </code></pre>