title: How to Fit WPF StackPanel to Grid Cell
body: <p>I have a StackPanel control in my WPF project, and it is in column 0 row 2 of a Grid. How can I autofit the StackPanel size to the size of that grid cell? Setting the StackPanel width and height to "auto" will just size it to its contents. I could explicitly set its width and height to numerical values, but I was wondering if there was a cleaner, more accurate way. Thank you.</p>
  
  <p>Relevant XAML:</p>
  
  <pre><code>&lt;Grid&gt;
      &lt;Grid.ColumnDefinitions&gt;
          &lt;ColumnDefinition Width="1*"/&gt;
          &lt;ColumnDefinition Width="1*"/&gt;
      &lt;/Grid.ColumnDefinitions&gt;
      &lt;Grid.RowDefinitions&gt;
          &lt;RowDefinition Height="74*"/&gt;
          &lt;RowDefinition Height="74*"/&gt;
          &lt;RowDefinition Height="421*"/&gt;
      &lt;/Grid.RowDefinitions&gt;
      &lt;Label Content="{StaticResource LoginWindow_Title}" Style="{StaticResource TitleH1}" Grid.ColumnSpan="2"/&gt;
      &lt;Label Content="{StaticResource LoginWindow_Subtitle}" Style="{StaticResource TitleH2}" Grid.Row="1" Grid.ColumnSpan="2"/&gt;
      &lt;Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Center" Grid.Row="2" VerticalAlignment="Top"&gt;
          &lt;StackPanel HorizontalAlignment="Left" Grid.Row="2" VerticalAlignment="Top"&gt;
              &lt;Label Content="Log in"/&gt;
          &lt;/StackPanel&gt;
      &lt;/Border&gt;
  &lt;/Grid&gt;
  </code></pre>