title: How to Resize ListView control when resizing window
body: <p>I have a user control that holds a ListView within a grid.
  But my problem is that if i maximize my applications window the ListView dimension (Height) does not change relative to the window. It always keeps the same height. In this case 200 as defined below.</p>
  
  <pre><code>&lt;UserControl x:Class="ModuleLogger.Views.ViewLogger"
               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
               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" 
               mc:Ignorable="d" &gt;
      &lt;Grid&gt;
          &lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition Height="15" /&gt;
              &lt;RowDefinition Height="30" /&gt;
              &lt;RowDefinition Height="15" /&gt;
              &lt;RowDefinition Height="1*" /&gt;
          &lt;/Grid.RowDefinitions&gt;
          &lt;Grid.ColumnDefinitions&gt;
              &lt;ColumnDefinition Width="20"/&gt;
              &lt;ColumnDefinition Width="*"/&gt;
              &lt;ColumnDefinition Width="20"/&gt;
          &lt;/Grid.ColumnDefinitions&gt;
          &lt;Label Grid.Row="1" Grid.Column="0" Content="Log Entries" Style="{StaticResource myLblStatHeaderSmallStyle}"  HorizontalAlignment="Stretch" Grid.ColumnSpan="6" /&gt;
          &lt;ListView x:Name="lvLogs"  Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="3" ItemsSource="{Binding LogEntries}" Style="{StaticResource myListViewStyle}"&gt;
              &lt;ListView.View&gt;
                  &lt;GridView&gt;
                      &lt;GridViewColumn Header="Log Entry" Width="810"&gt;
                          &lt;GridViewColumn.CellTemplate&gt;
                              &lt;DataTemplate&gt;
                                  &lt;TextBlock TextWrapping="Wrap" Text="{Binding Path=Entry}"&gt;&lt;/TextBlock&gt;
                              &lt;/DataTemplate&gt;
                          &lt;/GridViewColumn.CellTemplate&gt;
                      &lt;/GridViewColumn&gt;
                  &lt;/GridView&gt;
              &lt;/ListView.View&gt;
          &lt;/ListView&gt;
      &lt;/Grid&gt;
  &lt;/UserControl&gt;
  
  &lt;Style x:Key="myListViewStyle" TargetType="{x:Type ListView}"&gt;
      &lt;Setter Property="Background" Value="WhiteSmoke"/&gt;
      &lt;Setter Property="BorderBrush" Value="Gray"/&gt;
      &lt;Setter Property="BorderThickness" Value="1"/&gt;
      &lt;Setter Property="Margin" Value="5,5,5,5"/&gt;
      &lt;Setter Property="Focusable" Value="False"/&gt;
      &lt;Setter Property="Foreground" Value="Black"/&gt;
      &lt;Setter Property="FontWeight" Value="Normal"/&gt;
      &lt;Setter Property="VerticalContentAlignment" Value="Center"/&gt;
      &lt;Setter Property="HorizontalContentAlignment" Value="Center"/&gt;
  &lt;/Style&gt;
  </code></pre>
  
  <p>The user control itself is used within a tabitem.</p>
  
  <pre><code>&lt;TabItem Header="Log" Name="tabLog" BorderBrush="LightGray" Style="{StaticResource myMainTabItemStyle}" VerticalContentAlignment="Stretch"&gt;
      &lt;ItemsControl Name="RegionLog" prism:RegionManager.RegionName="RegionLog" Grid.Column="0"/&gt;
  &lt;/TabItem&gt;
  </code></pre>
  
  <p>I have tried to change my RowDefinition to</p>
  
  <pre><code>&lt;Grid.RowDefinitions&gt;
       &lt;RowDefinition Height="15" /&gt;
       &lt;RowDefinition Height="30" /&gt;
       &lt;RowDefinition Height="15" /&gt;
       &lt;RowDefinition Height="1*" /&gt;
  &lt;/Grid.RowDefinitions&gt;
  </code></pre>
  
  <p>This approach solves my problem. But it brings me to another problem. In this case i dont get a vertical scrollbar. So the ListView becomes "endless" and you can just see the top entries.</p>
  
  <p>Is there a way to define the Grid//ListView so that the ListView automatically resizes if the window resizes? </p>