title: How to get a UserControl to stretch to fill the alloted space?
body: <p>In a 630 x 400 Window, I'm loading there XAML elements:</p>
  
  <ul>
  <li>menu at top</li>
  <li>dynamic user control</li>
  <li>footer at the bottom</li>
  </ul>
  
  <p>The problem is that when I set the background of the UserControl, <strong>the color only goes down as far as the content</strong>.  I want the background of the UserControl to cover the whole UserControl of course. I've tried:</p>
  
  <ul>
  <li><strong>VerticalContentAlignment</strong>="Stretch" in the <strong>UserControl</strong></li>
  <li><strong>VerticalAlignment</strong>="Stretch" in the <strong>UserControl</strong></li>
  <li><strong>VerticalContentAlignment</strong>="Stretch" in the <strong>MainView</strong></li>
  <li><strong>VerticalAlignment</strong>="Stretch" in the <strong>MainView</strong></li>
  </ul>
  
  <p>But the color still refuses to go down. I don't want to set a fixed width since the user is able to increase the size of the application.</p>
  
  <p><strong>How can I get the background color of my UserControl to fill the full area of the UserControl</strong> instead of only the area of its content?</p>
  
  <p><strong>PageItemOptionsView.xaml:</strong></p>
  
  <pre><code>&lt;UserControl x:Class="TestMenu234.Views.PageItemOptionsView"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
               VerticalContentAlignment="Stretch"
               VerticalAlignment="Stretch"
               Background="#ddd"&gt;
      &lt;StackPanel Margin="10"&gt;
          &lt;TextBlock Text="This is the options area."/&gt;
          &lt;Button Content="Click to go to the Manage Customers page."
                      Width="200"/&gt;
      &lt;/StackPanel&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p><strong>MainView.xaml:</strong></p>
  
  <pre><code>&lt;Window x:Class="TestMenu234.Views.MainView"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:c="clr-namespace:TestMenu234.Commands"
      xmlns:vm="clr-namespace:TestMenu234.ViewModels"
      xmlns:v="clr-namespace:TestMenu234.Views"
      Title="Main Window" Height="400" Width="630" MinWidth="630"&gt;
  </code></pre>
  
  <p>...</p>
  
  <pre><code>    &lt;DockPanel LastChildFill="False"&gt;
  
          &lt;Menu DockPanel.Dock="Top"&gt;
              &lt;MenuItem 
                  Header="Pages" ItemsSource="{Binding AllPageItemViewModels}"
                        ItemTemplate="{StaticResource CodeGenerationMenuTemplate}"/&gt;
          &lt;/Menu&gt;
  
          &lt;ContentControl
              DockPanel.Dock="Top"
              VerticalAlignment="Stretch"
              VerticalContentAlignment="Stretch"
              Content="{Binding CurrentPageItemViewModel}"/&gt;
  
          &lt;Border DockPanel.Dock="Bottom" Padding="5 5 5 0" Background="#eee"&gt;
              &lt;Grid Background="#eee"&gt;
                  &lt;Grid.ColumnDefinitions&gt;
                      &lt;ColumnDefinition Width="*" MinWidth="300"/&gt;
                      &lt;ColumnDefinition Width="200"/&gt;
                      &lt;ColumnDefinition Width="100"/&gt;
                  &lt;/Grid.ColumnDefinitions&gt;
                  &lt;Slider 
                  Grid.Column="0"
                  HorizontalAlignment="Left"
                  Value="{Binding CurrentPageItemViewModelIndex}"
                  Width="300"
                  Minimum="0"
                  Maximum="{Binding HighestPageItemIndex}"/&gt;
  
                  &lt;TextBlock Grid.Column="1" 
                             HorizontalAlignment="Center" FontWeight="Bold" 
                             Text="{Binding CurrentPageItemViewModelTitle}"/&gt;
  
                  &lt;DockPanel Grid.Column="2" Margin="0 0 0 5" LastChildFill="False"&gt;
                      &lt;Button
                      Margin="3 0 0 0"
                      DockPanel.Dock="Right"
                  HorizontalAlignment="Right"
                  Content="Next" Command="{Binding NextPageCommand}"/&gt;
                      &lt;Button
                      DockPanel.Dock="Right"
                  Content="Prev" Command="{Binding PreviousPageCommand}"/&gt;
                  &lt;/DockPanel&gt;
              &lt;/Grid&gt;
          &lt;/Border&gt;
  
      &lt;/DockPanel&gt;
  &lt;/Window&gt;
  </code></pre>