title: How to make usercontrol take whole space of the region its injected into
body: <p>I have a view which is injected into an region (Itemscontrol). The view only takes up space in the region depending on content size. I want that the view streches for whole height of the region. Here is code of my view:</p>
  
  <pre><code>    &lt;UserControl x:Name="userControl" x:Class="DishPromo.Modules.Payments.SideCart.SideCartView"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
           xmlns:infUIFramework="clr-namespace:DishPromo.Infrastructure.UIFramework;assembly=DishPromo.Infrastructure"
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:Convert="clr-namespace:DishPromo.Modules.Payments.SideCart"
           mc:Ignorable="d"  &gt;
  &lt;UserControl.Resources&gt;
      &lt;Convert:ObjectToStringConverter x:Key="ToString" /&gt;
      &lt;Convert:BooleanToVisibilityConverter x:Key="ToVisibility" /&gt;
      &lt;Convert:WOMsgVisibilityConverter x:Key="WOMsgVisibility" /&gt;
      &lt;Convert:WorkOrderMsgConverter x:Key="WorkOrderMsg" /&gt;
      &lt;Convert:RescheduleValueConverter x:Key="ValueConverter" /&gt;
      &lt;Convert:PaymentAmountDueNow x:Key="PaymentAmountDueNow" /&gt;
  
      &lt;Style TargetType="Button" x:Key="hotkeyStyle"&gt;
          &lt;Setter Property="Width" Value="Auto"/&gt;
          &lt;Setter Property="Height" Value="25"/&gt;
          &lt;Setter Property="HorizontalContentAlignment" Value="Center"/&gt;
          &lt;Setter Property="Template"&gt;
  
              &lt;Setter.Value&gt;
                  &lt;ControlTemplate TargetType="Button"&gt;
                      &lt;Grid Background="Transparent"&gt;
                          &lt;Border Name="border"                           
                          Padding="4,2" CornerRadius="3"
                          BorderBrush="DarkGray" 
                          /&gt;
  
  
                          &lt;Rectangle x:Name="FVElement" Stretch="Fill" StrokeLineJoin="Miter" StrokeThickness="0.5" Opacity="0" RadiusX="2" RadiusY="2"
                                 HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Fill="{StaticResource {x:Static SystemColors.ControlLightLightBrushKey}}" Stroke="{StaticResource OEFlowButtonBorderStyle}"
                                 &gt;
                          &lt;/Rectangle&gt;
                          &lt;Rectangle x:Name="Background" StrokeLineJoin="Miter" StrokeThickness="0.5" Opacity="1" Margin="2" RadiusX="3" RadiusY="3"&gt;
                              &lt;Rectangle.Fill&gt;
                                  &lt;LinearGradientBrush StartPoint="0,0" EndPoint="0,1" &gt;
                                      &lt;GradientStop Color="{StaticResource {x:Static SystemColors.ControlColorKey}}" Offset="0.576" /&gt;
                                      &lt;GradientStop Color="{StaticResource {x:Static SystemColors.ControlLightLightColorKey}}" Offset="0" /&gt;
                                      &lt;GradientStop Color="{StaticResource {x:Static SystemColors.ControlColorKey}}" Offset="1" /&gt;
                                      &lt;GradientStop Color="{StaticResource {x:Static SystemColors.ControlLightColorKey}}" Offset="0.262" /&gt;
                                  &lt;/LinearGradientBrush&gt;
                              &lt;/Rectangle.Fill&gt;
                              &lt;Rectangle.Stroke&gt;
                                  &lt;LinearGradientBrush EndPoint="0.5,-1.85" StartPoint="0.5,1.5"&gt;
                                      &lt;GradientStop Color="Black" Offset="0"/&gt;
                                      &lt;GradientStop Color="Black" Offset="1"/&gt;
                                  &lt;/LinearGradientBrush&gt;
                              &lt;/Rectangle.Stroke&gt;
                          &lt;/Rectangle&gt;
                          &lt;Path x:Name="WhiteBand" Height="4.25" Stretch="Fill" StrokeLineJoin="Miter" Fill="{StaticResource OEFlowButtonWhiteBandFillStyle}"
                            Data="M4.2160064,2.75 C4.2160064,1.6454305 5.1114369,1.7153466 6.2160064,1.7153466 L22.679308,1.7153466 C23.783877,1.7153466 24.679308,1.6454305 24.679308,2.75 24.679308,2.75 4.2160064,2.75 4.2160064,2.75 z" 
                            Margin="7,4,7,0" HorizontalAlignment="Center" VerticalAlignment="Top"/&gt;
  
                          &lt;TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black" FontWeight="Light"  
                                 TextWrapping="WrapWithOverflow" Text="{TemplateBinding Content}" x:Name="btnName" &gt;
  
                          &lt;/TextBlock&gt;
                          &lt;ContentPresenter /&gt;
                      &lt;/Grid&gt;
                      &lt;ControlTemplate.Triggers&gt;
                          &lt;Trigger Property="IsMouseOver" Value="True"&gt;
                              &lt;Setter TargetName="border" Property="BorderBrush" Value="#FF585151" /&gt;
                              &lt;Setter Property="Cursor" Value="Hand" /&gt;
                          &lt;/Trigger&gt;
                          &lt;Trigger Property="IsPressed" Value="True"&gt;
                              &lt;Setter Property="Background" &gt;
                                  &lt;Setter.Value&gt;
                                      &lt;LinearGradientBrush StartPoint="0,0" EndPoint="0,1" &gt;
                                          &lt;GradientStop Color="#FF219921" Offset="0.35"/&gt;
                                          &lt;GradientStop Color="#FF216B99" Offset="1"/&gt;
                                      &lt;/LinearGradientBrush&gt;
                                  &lt;/Setter.Value&gt;
                              &lt;/Setter&gt;
                              &lt;Setter  Property="RenderTransform" &gt;
                                  &lt;Setter.Value&gt;
                                      &lt;TranslateTransform Y="0.5" /&gt;
                                  &lt;/Setter.Value&gt;
                              &lt;/Setter&gt;
                          &lt;/Trigger&gt;
                          &lt;Trigger Property="IsEnabled" Value="False"&gt;
                              &lt;Setter TargetName="border" Property="Opacity" Value="0.3" /&gt;
                              &lt;Setter TargetName="Background" Property="Opacity"  Value="0.3" /&gt;
                              &lt;Setter TargetName="FVElement" Property="Opacity" Value="0.3" /&gt;
                              &lt;Setter TargetName="btnName" Property="Foreground" Value="Gray"/&gt;
                          &lt;/Trigger&gt;
                      &lt;/ControlTemplate.Triggers&gt;
                  &lt;/ControlTemplate&gt;
              &lt;/Setter.Value&gt;
          &lt;/Setter&gt;
      &lt;/Style&gt;
  &lt;/UserControl.Resources&gt;
  &lt;DockPanel VerticalAlignment="Stretch" LastChildFill="True" &gt;
  
      &lt;DockPanel.InputBindings&gt;
          &lt;KeyBinding Command="{Binding MinPaymentOverride}" Gesture="SHIFT+CTRL+y"&gt;&lt;/KeyBinding&gt;
          &lt;KeyBinding Command="{Binding PIAMinPaymentOverride}" Gesture="SHIFT+CTRL+m"&gt;&lt;/KeyBinding&gt;
          &lt;KeyBinding Command="{Binding EFTOverride}" Gesture="SHIFT+CTRL+e"&gt;&lt;/KeyBinding&gt;
          &lt;KeyBinding Command="{Binding CCOverride}" Gesture="SHIFT+CTRL+c"&gt;&lt;/KeyBinding&gt;
          &lt;KeyBinding Command="{Binding OverrideCC}" Gesture="SHIFT+CTRL+c"&gt;&lt;/KeyBinding&gt;
          &lt;KeyBinding Command="{Binding OverrideSSN}"  Gesture="SHIFT+CTRL+s"&gt;&lt;/KeyBinding&gt;
          &lt;KeyBinding Command="{Binding OverrideCertificate}"  Gesture="SHIFT+CTRL+j"&gt;&lt;/KeyBinding&gt;
          &lt;KeyBinding Command="{Binding OverrideSellingAgent}"  Gesture="SHIFT+CTRL+d"&gt;&lt;/KeyBinding&gt;
          &lt;KeyBinding Command="{Binding OverrideRefCompany}"  Gesture="SHIFT+CTRL+i"&gt;&lt;/KeyBinding&gt;
          &lt;KeyBinding Command="{Binding OverrideSellingCompany}"  Gesture="SHIFT+CTRL+n"&gt;&lt;/KeyBinding&gt;
      &lt;/DockPanel.InputBindings&gt;
  
      &lt;DockPanel.Style&gt;
          &lt;Style&gt;
              &lt;Style.Triggers&gt;
                  &lt;DataTrigger Binding="{Binding ChangeFocus}" Value="True"&gt;
                      &lt;Setter Property="FocusManager.FocusedElement" Value="{Binding ElementName=SidecartRemove}"/&gt;
                  &lt;/DataTrigger&gt;
              &lt;/Style.Triggers&gt;
          &lt;/Style&gt;
      &lt;/DockPanel.Style&gt;
  
      &lt;!--&lt;Grid.RowDefinitions&gt;
          &lt;RowDefinition /&gt;
  
      &lt;/Grid.RowDefinitions&gt;--&gt;
      &lt;DockPanel x:Name="dpNotificationArea"  Margin="0"  VerticalAlignment="Bottom" AllowDrop="True" LastChildFill="True" &gt;
  
          &lt;!--&lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition MinHeight="350" /&gt;
              &lt;RowDefinition Height="29"/&gt;
              &lt;RowDefinition Height="58"/&gt;
              &lt;RowDefinition Height="27"/&gt;
          &lt;/Grid.RowDefinitions&gt;--&gt;
  
          &lt;Grid Grid.Row="3" VerticalAlignment="Bottom" DockPanel.Dock="Bottom"&gt;
              &lt;Grid.ColumnDefinitions&gt;
                  &lt;ColumnDefinition/&gt;
                  &lt;ColumnDefinition Width="260"/&gt;
              &lt;/Grid.ColumnDefinitions&gt;
  
              &lt;Label Grid.Column="0" Width="Auto" FontWeight="Bold" Foreground="Red"&gt;
                  &lt;MultiBinding Converter="{StaticResource PaymentAmountDueNow}"&gt;
                      &lt;Binding Path="CustomerModel.AccountInfo.Pricer.PaymentRequired"/&gt;
                      &lt;Binding Path="CustomerModel.AccountInfo.AccountStatus"/&gt;
                  &lt;/MultiBinding&gt;
              &lt;/Label&gt;
  
              &lt;StackPanel Grid.Column="1" x:Name="spPricerActionBar" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right"&gt;
                  &lt;Button Style="{StaticResource hotkeyStyle}" Width="80" x:Name="SidecartRemove" Command="{Binding RemoveCartItem}" 
                      IsEnabled="{Binding CustomerModel.ControlStatus.RemoveIsEnabled}" GotFocus="SidecartRemove_GotFocus"&gt;
                      &lt;TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black" FontWeight="Light"&gt;&lt;Run Text="Re"/&gt;&lt;Underline&gt;&lt;Run Text="m"/&gt;&lt;/Underline&gt;&lt;Run Text="ove"/&gt;&lt;/TextBlock&gt;
                  &lt;/Button&gt;
  
                  &lt;Button x:Name="btnFeeWaived" Width="80" Content="Fees Waived" IsEnabled="{Binding IsFeeWaivedEnabled}" 
                      Command="{Binding ShowBattery}"  GotFocus="btnFeeWaived_GotFocus" /&gt;    
                  &lt;Button Width="100" Content="Price It" HorizontalAlignment="Right" Visibility="{Binding PriceItVisibility}"  Command="{Binding GetPricing}" Background="#FF6633" Style="{StaticResource PriceItStyle}"/&gt;
              &lt;/StackPanel&gt;
          &lt;/Grid&gt;
  
          &lt;StackPanel x:Name="spWorkOrder" Grid.Row="2" VerticalAlignment="Bottom" DockPanel.Dock="Bottom"&gt;
              &lt;Grid Margin="0,0,0,6"&gt;
                  &lt;Grid.ColumnDefinitions&gt;
                      &lt;ColumnDefinition Width="*" /&gt;
                      &lt;ColumnDefinition Width="75" /&gt;
                  &lt;/Grid.ColumnDefinitions&gt;
                  &lt;Grid.RowDefinitions&gt;
                      &lt;RowDefinition Height="50"/&gt;
                  &lt;/Grid.RowDefinitions&gt;
                  &lt;StackPanel Grid.Column="1" VerticalAlignment="Bottom"&gt;
                      &lt;Button Width="70" Height="25" x:Name="btnReschedule1" Content="Reschedule" HorizontalAlignment="Right" Command="{Binding GetInstallDates}" CommandParameter="1"
                          Visibility="{Binding CustomerModel.AccountInfo.ScheduleInfo, ConverterParameter=1, Converter={StaticResource ToVisibility}}" /&gt;
                      &lt;Button Width="70" x:Name="btnReschedule0" Content="Reschedule" HorizontalAlignment="Right" Command="{Binding GetInstallDates}" CommandParameter="0"
                          Visibility="{Binding CustomerModel.AccountInfo.ScheduleInfo, ConverterParameter=0, Converter={StaticResource ToVisibility}}" /&gt;
                  &lt;/StackPanel&gt;
                  &lt;StackPanel Grid.Column="0" VerticalAlignment="Bottom"&gt;
                      &lt;Label Margin="0,5,0,5" Content="{Binding CustomerModel.AccountInfo.WorkorderInfo.DisconnectDate, Converter={StaticResource WorkOrderMsg}}"
                          HorizontalAlignment="Left" FontWeight="Bold" Foreground="Blue" Visibility="{Binding CustomerModel.AccountInfo.WorkorderInfo.DisconnectDate, ConverterParameter=0, Converter={StaticResource WOMsgVisibility}}" VerticalAlignment="Center"/&gt;
                      &lt;Label Margin="0,5,0,5" Content="{Binding CustomerModel.AccountInfo.ScheduleInfo[1], Converter={StaticResource ValueConverter}}" 
                          HorizontalAlignment="Left" FontWeight="Bold" Foreground="Blue" Visibility="{Binding Visibility, ElementName=btnReschedule1}" VerticalAlignment="Center"/&gt;
                      &lt;Label Margin="0,5,0,5" Content="{Binding CustomerModel.AccountInfo.ScheduleInfo[0], Converter={StaticResource ValueConverter}}" 
                          HorizontalAlignment="Left" FontWeight="Bold" Foreground="Blue" Visibility="{Binding Visibility, ElementName=btnReschedule0}" VerticalAlignment="Center"/&gt;
                  &lt;/StackPanel&gt;
              &lt;/Grid&gt;
          &lt;/StackPanel&gt;
  
          &lt;StackPanel x:Name="NetworkQualification" Grid.Row="1" Margin="4,0,0,0" VerticalAlignment="Bottom" DockPanel.Dock="Bottom"&gt;
              &lt;TextBlock x:Name="txtbNetQualStatus" Text="{Binding CustomerModel.ServiceAddress.NetQualResult}"  Foreground="Blue" FontWeight="Bold" /&gt;
              &lt;TextBlock x:Name="txtDupAddress" Text="{Binding CustomerModel.ServiceAddress.NoAddressFound}" Foreground="Blue" FontWeight="Bold"/&gt;
          &lt;/StackPanel&gt;
  
          &lt;ListView  Grid.Row="0"  Name="lstSideCart" ScrollViewer.HorizontalScrollBarVisibility="Auto" DockPanel.Dock="Top"
                     ScrollViewer.VerticalScrollBarVisibility="Auto" ItemsSource="{Binding CustomerModel.AccountInfo.Services}" SelectionMode="Extended" 
                     SelectionChanged="lstSideCart_SelectionChanged" MaxHeight="781" VerticalContentAlignment="Stretch" &gt;
          &lt;ListView.ItemContainerStyle&gt;
              &lt;Style TargetType="ListViewItem"&gt;
                  &lt;Setter Property="Foreground" Value="{Binding Path=ForegroundColor}"/&gt;
                  &lt;Setter Property="FontWeight" Value="{Binding Path=FontWeight}"/&gt;
                  &lt;Setter Property="BorderBrush"&gt;
                      &lt;Setter.Value&gt;
                          &lt;LinearGradientBrush StartPoint="0,0" EndPoint="0,1" &gt;
                              &lt;GradientStop Color="DarkGray" Offset="0.0" /&gt;
                              &lt;GradientStop Color="DarkGray" Offset="1.0" /&gt;
                          &lt;/LinearGradientBrush&gt;
                      &lt;/Setter.Value&gt;
                  &lt;/Setter&gt;
                  &lt;Setter Property="BorderThickness" Value="0,0,0,0.5"/&gt;
              &lt;/Style&gt;
          &lt;/ListView.ItemContainerStyle&gt;
          &lt;ListView.ContextMenu&gt;
              &lt;ContextMenu ItemsSource="{Binding ContextMenuList}"&gt;
                  &lt;ContextMenu.ItemTemplate&gt;
                      &lt;DataTemplate&gt;
                          &lt;MenuItem Header="{Binding Path=Header}" CommandParameter="{Binding}"
                                    Click="MenuItem_Click" Visibility="{Binding Path=IsVisible}" Height="16"/&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/ContextMenu.ItemTemplate&gt;
              &lt;/ContextMenu&gt;
          &lt;/ListView.ContextMenu&gt;
          &lt;ListView.View&gt;
              &lt;GridView&gt;
                  &lt;GridViewColumn Width="175" Header="Service Code Name" DisplayMemberBinding="{Binding Description}" /&gt;
                  &lt;GridViewColumn Width="100" Header="Service Type" DisplayMemberBinding="{Binding ServiceCode.SecondaryServiceTypeSingle.ServiceTypeName}"/&gt;
                  &lt;GridViewColumn Width="25" Header="#" DisplayMemberBinding="{Binding CurrentQuantity}"/&gt;
                  &lt;GridViewColumn Width="68" Header="Added" DisplayMemberBinding="{Binding Path=DateAdded, StringFormat={}{0:MM/dd/yy}}"/&gt;
              &lt;/GridView&gt;
          &lt;/ListView.View&gt;
      &lt;/ListView&gt;
  
      &lt;/DockPanel&gt;
  
  &lt;/DockPanel&gt;
  </code></pre>
  
  <p></p>