title: WPF TextBox Stretching
body: <p>I've got XAML below that shows what I want to do. It's pretty simply. </p>
  
  <p>I have a Window that contains a grid. The grid contains a tab control with several tab items. The tab item shown below in the code contains a grid. The grid has two columns and six rows. Each row contains a label (column 0) and text box (column 1). I would like the label column to consume just as much space as needed. I want the text box column to consume the rest of the width of the row. And, as the user resizes the window horizontally, I want the text box column to contract and expand with the window. The code below does not do this, and I'm not sure what I need to do to fix this.</p>
  
  <pre><code>&lt;Grid Background="#18AFA117"&gt;
          &lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition Height="Auto" /&gt;
              &lt;RowDefinition Height="*" /&gt;
          &lt;/Grid.RowDefinitions&gt;
          &lt;Button Content="Generate" Grid.Row="1" Height="23" HorizontalAlignment="Left" Margin="54,8,0,0" Name="Generatebutton" VerticalAlignment="Top" Width="75" Click="Generatebutton_Click" /&gt;
          &lt;Button Content="Cancel" Height="23" HorizontalAlignment="Left" Margin="151,8,0,0" Name="CancelButton" VerticalAlignment="Top" Width="75" Grid.Row="1" Click="CancelButton_Click" /&gt;
          &lt;TabControl HorizontalAlignment="Stretch" Margin="5,5,5,416" Name="tabControl1" VerticalAlignment="Stretch" Height="Auto" SelectionChanged="tabControl1_SelectionChanged"&gt;
              &lt;TabItem Header="TFS Configuration" Name="TFSTab"&gt;
                  &lt;Grid HorizontalAlignment="Stretch"&gt;
                      &lt;Grid.ColumnDefinitions&gt;
                          &lt;ColumnDefinition Width="Auto" /&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;RowDefinition Height="Auto" /&gt;
                          &lt;RowDefinition Height="Auto" /&gt;
                          &lt;RowDefinition Height="Auto" /&gt;
                          &lt;RowDefinition Height="Auto" /&gt;
                      &lt;/Grid.RowDefinitions&gt;
                      &lt;Label Content="TFS Server:" Grid.Column="0" Grid.Row="0" Height="25" HorizontalAlignment="Left" Margin="6,1,0,0" Name="label04" VerticalAlignment="Top" /&gt;
                      &lt;Label Content="TFS Workspace Name:" Grid.Column="0" Grid.Row="1" Height="25" HorizontalAlignment="Left" Margin="6,1,0,0" Name="label05" VerticalAlignment="Top" /&gt;
                      &lt;Label Content="TFS Local Folder:" Grid.Column="0" Grid.Row="2" Height="25" HorizontalAlignment="Left" Margin="6,1,0,0" Name="label06" VerticalAlignment="Top" /&gt;
                      &lt;Label Content="TFS Framework Solution Path:" Grid.Column="0" Grid.Row="3" Height="25" HorizontalAlignment="Left" Margin="6,1,0,0" Name="label07" VerticalAlignment="Top" /&gt;
                      &lt;Label Content="TFS Checkin Comments:" Grid.Column="0" Grid.Row="4" Height="25" HorizontalAlignment="Left" Margin="6,1,0,0" Name="label08" VerticalAlignment="Top" /&gt;
                      &lt;Label Content="TFS Shelveset Name:" Grid.Column="0" Grid.Row="5" Height="25" HorizontalAlignment="Left" Margin="6,1,0,0" Name="label09" VerticalAlignment="Top" /&gt;
  
                      &lt;TextBox Grid.Row="0" Grid.Column="1" Height="21" HorizontalAlignment="Stretch" Margin="13,3,0,0" Name="TFSServer" VerticalAlignment="Top"/&gt;
                      &lt;TextBox Grid.Row="1" Grid.Column="1" Height="21" HorizontalAlignment="Stretch" Margin="13,3,0,0" Name="TFSWorkspaceName" VerticalAlignment="Top" /&gt;
                      &lt;TextBox Grid.Row="2" Grid.Column="1" Height="21" HorizontalAlignment="Stretch" Margin="13,3,0,0" Name="TFSLocalFolder" VerticalAlignment="Top" /&gt;
                      &lt;ComboBox Grid.Row="3" Grid.Column="1" Height="23" HorizontalAlignment="Stretch" Margin="13,3,0,0" Name="TFSSolutionPaths" VerticalAlignment="Top" /&gt;
                      &lt;TextBox Grid.Row="4" Grid.Column="1" Height="21" HorizontalAlignment="Stretch" Margin="13,3,0,0" Name="TFSCheckinComments" VerticalAlignment="Top" /&gt;
                      &lt;TextBox Grid.Row="5" Grid.Column="1" Height="21" HorizontalAlignment="Stretch" Margin="13,3,0,0" Name="TFSShelvesetName" VerticalAlignment="Top" /&gt;
                  &lt;/Grid&gt;
              &lt;/TabItem&gt;
  </code></pre>