title: Vertical scroll bar is not viewing inside a grid for a list view in WPF
body: <p>I have a design for my user control. The control contains many rows and columns and inside it has sub-grids and rows and columns. One of the inner most row contains a ListView whose Horizontal and Vertical Scroll bar set to Auto.</p>
  
  <p>I am able to view Horizontal Scroll bar for listview as well as the outer most grid, but I am unable to view Vertical Scroll bar for listview, but for the outer grid is working fine.</p>
  
  <p>Here is the xaml for the same.</p>
  
  <pre><code>&lt;Grid&gt;
      &lt;Grid.RowDefinitions&gt;
          &lt;RowDefinition Height="Auto"/&gt;
          &lt;RowDefinition Height="Auto"/&gt;
          &lt;RowDefinition /&gt;
      &lt;/Grid.RowDefinitions&gt;
  
      &lt;StackPanel Grid.Row="0" Orientation="Horizontal" VerticalAlignment="Center" Margin="8,0,0,0"&gt;
          &lt;Image Source="pack://application:,,,/EMC.DD.CommonFrameworkLayer;component/Images/Items1.png" Width="50" Height="50"&gt;&lt;/Image&gt;
          &lt;TextBlock Text="Items" VerticalAlignment="Center" Style="{StaticResource  DashboardTextBlockStyle}" Margin="8,0,0,0" &gt;&lt;/TextBlock&gt;
      &lt;/StackPanel&gt;
  
      &lt;StackPanel Orientation="Horizontal" Grid.Row="1" Background="#eaeaea" Margin="8,0,0,0"&gt;
          &lt;Image Source="pack://application:,,,/EMC.DD.CommonFrameworkLayer;component/Images/HomeDashBoard.png"&gt;&lt;/Image&gt;
          &lt;TextBlock Text="DashBoard" Style="{StaticResource HomeDashBoardTextBlockStyle}" VerticalAlignment="Center" Margin="8,0,0,0"&gt;&lt;/TextBlock&gt;
          &lt;TextBlock Text="&gt;" VerticalAlignment="Center" Margin="5,0,0,0" Style="{StaticResource HomeDashBoardTextBlockStyle}" FontWeight="Medium"&gt;&lt;/TextBlock&gt;
          &lt;TextBlock Text="Items" VerticalAlignment="Center" Margin="5,0,0,0" Style="{StaticResource HomeDashBoardTextBlockStyle}" FontWeight="Medium"&gt;&lt;/TextBlock&gt;
          &lt;TextBlock x:Name="ItemsTextBlock" x:FieldModifier="private" Margin="5,0,0,0" VerticalAlignment="Center"&gt;&lt;/TextBlock&gt;
      &lt;/StackPanel&gt;
  
      &lt;ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Grid.Row="2" Grid.Column="0"&gt;
  
          &lt;Grid&gt;
              &lt;Grid.RowDefinitions&gt;
                  &lt;RowDefinition Height="Auto"/&gt;
                  &lt;RowDefinition Height="Auto"/&gt;
                  &lt;RowDefinition Height="*"/&gt;
              &lt;/Grid.RowDefinitions&gt;
  
              &lt;StackPanel Grid.Row="0" Orientation="Horizontal" VerticalAlignment="Center" Margin="8,10,0,10"&gt;
                  &lt;TextBox x:Name="ItemTextBox" MinWidth="160" Height="25"&gt;
                  &lt;/TextBox&gt;
              &lt;/StackPanel&gt;
  
              &lt;StackPanel Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Center" Margin="8,2,0,10"&gt;
                  &lt;ComboBox x:Name="CategoryComboBox" DisplayMemberPath="CategoryName" SelectedValue="CategoryID" SelectedValuePath="CategoryName" 
                    Margin="2,2,0,3" MinHeight="27" MinWidth="250" Grid.Row="2" Grid.Column="2" HorizontalAlignment="Left" Grid.ColumnSpan="2" SelectedIndex="-1"/&gt;
                  &lt;Button Style="{StaticResource CRUDButtonStyle}" Content="Search" Margin="5,0,0,0" Click="SearchButton_Click"&gt;&lt;/Button&gt;
  
                  &lt;StackPanel Orientation="Horizontal" Margin="150,0,0,0"&gt;
                      &lt;Button Style="{StaticResource CRUDButtonStyle}" Content="New Item" Click="ItemButton_Click" &gt;&lt;/Button&gt;
                      &lt;Button Style="{StaticResource CRUDButtonStyle}" Content="Delete Item" Margin="5,0,0,0" Click="DeleteButton_Click"&gt;&lt;/Button&gt;
                      &lt;Button Style="{StaticResource CRUDButtonStyle}" Content="Delete All" Margin="2,0,0,0" Click="DeleteAllItem_Click"&gt;&lt;/Button&gt;
                  &lt;/StackPanel&gt;
              &lt;/StackPanel&gt;
  
              &lt;Grid Grid.Row="2" Margin="8,0,0,0"&gt;
                  &lt;Grid.ColumnDefinitions&gt;
                      &lt;ColumnDefinition Width="900"/&gt;
                      &lt;ColumnDefinition Width="Auto" MinWidth="200"/&gt;
                  &lt;/Grid.ColumnDefinitions&gt;
  
                  &lt;Grid Grid.Column="0"&gt;
  
                      &lt;Grid.RowDefinitions&gt;
                          &lt;RowDefinition Height="Auto" /&gt;
                          &lt;RowDefinition Height="*"/&gt;
                          &lt;RowDefinition Height="10" /&gt;
                      &lt;/Grid.RowDefinitions&gt;
  
                      &lt;Border Grid.Row="0" Style="{StaticResource DefaultBorderStyle}"&gt;
                          &lt;StackPanel Grid.Row="0" Orientation="Horizontal" VerticalAlignment="Top" Margin="0,0,0,0"&gt;
                              &lt;Image Source="pack://application:,,,/EMC.DD.CommonFrameworkLayer;component/Images/Items1.png"&gt;&lt;/Image&gt;
                              &lt;TextBlock Text="List Of Items" Margin="5,0,0,0" VerticalAlignment="Center" 
                               Style="{StaticResource HomeDashBoardTextBlockStyle}" FontWeight="Normal"/&gt;
                          &lt;/StackPanel&gt;
                      &lt;/Border&gt;
  
                      &lt;ListView x:Name="ItemsListView" x:FieldModifier="private" Grid.Row="1" MouseDown="ListViewItem_PreviewMouseDown" 
                        SelectionChanged="ListView_SelectionChanged" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto"&gt;
                          &lt;ListView.Resources&gt;
                              &lt;Style TargetType="{x:Type GridViewColumnHeader}" x:Key="MyHeaderStyle"&gt;
                                  &lt;Setter Property="FontFamily"  Value="Segoe UI Light"/&gt;
                                  &lt;Setter Property="FontWeight" Value="DemiBold"&gt;&lt;/Setter&gt;
                                  &lt;Setter Property="Height" Value="30"&gt;&lt;/Setter&gt;
                              &lt;/Style&gt;
  
                              &lt;local:IntToBoolConverter x:Key="IntBoolKey"&gt;&lt;/local:IntToBoolConverter&gt;
  
                              &lt;Style x:Key="TextStyle" TargetType="{x:Type TextBlock}"&gt;
                                  &lt;EventSetter Event="Hyperlink.Click" Handler="EditClicked" /&gt;
                              &lt;/Style&gt;
  
                              &lt;local:BackgroundConverter x:Key="BackgroundKey"/&gt;
  
                              &lt;Style x:Key="columnHeaderContianerStyle" TargetType="ListViewItem"&gt;
                                  &lt;Setter Property="Background"&gt;
                                      &lt;Setter.Value&gt;
                                          &lt;Binding RelativeSource="{RelativeSource Self}" Converter="{StaticResource BackgroundKey}"/&gt;
                                      &lt;/Setter.Value&gt;
                                  &lt;/Setter&gt;
                                  &lt;!--&lt;EventSetter Event="PreviewMouseDown" Handler="ListViewItem_PreviewMouseDown"&gt;&lt;/EventSetter&gt;--&gt;
                              &lt;/Style&gt;
  
                              &lt;Style x:Key="myHeaderStyle" TargetType="{x:Type GridViewColumnHeader}"&gt;
                                  &lt;Style.Triggers&gt;
                                      &lt;Trigger Property="IsMouseOver" Value="False"&gt;
                                          &lt;Setter Property="Background" Value="#1570a6"/&gt;
                                          &lt;Setter Property="Foreground" Value="#FFFFFF"/&gt;
                                      &lt;/Trigger&gt;
                                      &lt;Trigger Property="IsMouseOver" Value="True"&gt;
                                          &lt;Setter Property="Foreground" Value="#000000"/&gt;
                                      &lt;/Trigger&gt;
                                  &lt;/Style.Triggers&gt;
                              &lt;/Style&gt;
  
                          &lt;/ListView.Resources&gt;
                          &lt;ListView.ItemContainerStyle&gt;
                              &lt;Style TargetType="{x:Type ListViewItem}" BasedOn="{StaticResource columnHeaderContianerStyle}"&gt;
                                  &lt;Setter Property="HorizontalContentAlignment" Value="Center"/&gt;
                                  &lt;Style.Triggers&gt;
                                      &lt;Trigger Property="IsKeyboardFocusWithin" Value="True"&gt;
                                          &lt;Setter Property="IsSelected" Value="True" /&gt;
                                      &lt;/Trigger&gt;
                                  &lt;/Style.Triggers&gt;
                              &lt;/Style&gt;
                          &lt;/ListView.ItemContainerStyle&gt;
                          &lt;ListView.View&gt;
                              &lt;GridView AllowsColumnReorder="true" ColumnHeaderContainerStyle="{StaticResource MyHeaderStyle}"&gt;
                                  &lt;GridViewColumn Width="50" HeaderContainerStyle="{StaticResource myHeaderStyle}"&gt;
                                      &lt;GridViewColumn.CellTemplate&gt;
                                          &lt;DataTemplate&gt;
                                              &lt;CheckBox Width ="20" Height="20" IsChecked="{Binding Path=IsActive,Converter={StaticResource IntBoolKey}}"&gt;&lt;/CheckBox&gt;
                                          &lt;/DataTemplate&gt;
                                      &lt;/GridViewColumn.CellTemplate&gt;
                                  &lt;/GridViewColumn&gt;
                                  &lt;GridViewColumn Header="Item ID" Width="110"  DisplayMemberBinding="{Binding Path=ItemID,Mode=OneWay}" 
                                   HeaderContainerStyle="{StaticResource myHeaderStyle}"/&gt;
                                  &lt;GridViewColumn Header="Item Name" Width="200" DisplayMemberBinding="{Binding Path=ItemName,Mode=OneWay}" 
                                   HeaderContainerStyle="{StaticResource myHeaderStyle}"/&gt;
                                  &lt;GridViewColumn Header="Item Price" Width="200" DisplayMemberBinding="{Binding Path=Price,Mode=OneWay}" 
                                   HeaderContainerStyle="{StaticResource myHeaderStyle}" &gt;
                                  &lt;/GridViewColumn&gt;
                                  &lt;GridViewColumn Header="Category" Width="200" DisplayMemberBinding="{Binding Path=Category.CategoryName,Mode=OneWay}" 
                                   HeaderContainerStyle="{StaticResource myHeaderStyle}"/&gt;
                                  &lt;GridViewColumn Header="Item Image" Width="200" HeaderContainerStyle="{StaticResource myHeaderStyle}"&gt;
                                      &lt;GridViewColumn.CellTemplate&gt;
                                          &lt;DataTemplate&gt;
                                              &lt;Image Width="100" Height="50" VerticalAlignment="Center" HorizontalAlignment="Center" 
                                                   Source="{Binding Path=ItemImagePath,Mode=OneWay}"&gt;&lt;/Image&gt;
                                          &lt;/DataTemplate&gt;
                                      &lt;/GridViewColumn.CellTemplate&gt;
                                  &lt;/GridViewColumn&gt;
                                  &lt;GridViewColumn Width="100" HeaderContainerStyle="{StaticResource myHeaderStyle}"&gt;
                                      &lt;GridViewColumn.CellTemplate&gt;
                                          &lt;DataTemplate&gt;
                                              &lt;TextBlock  Name="urlToContent" MinWidth="150" Width="Auto" Style="{StaticResource TextStyle}"&gt;
                                                &lt;Hyperlink NavigateUri="{Binding Path=URL}" Name="hlkURL"&gt;
                                                  &lt;TextBlock Text="Edit" HorizontalAlignment="Center"/&gt;  
                                               &lt;/Hyperlink&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;Grid Grid.Column="1"&gt;
  
                      &lt;GroupBox x:Name="ItemDetails" Header="Item Details" FontFamily="Segoe UI" HorizontalAlignment="Center" Margin="2,-10,0,0" 
                        VerticalAlignment="Top" Height="Auto" Width="Auto" Grid.Row="0"&gt;
                          &lt;Grid Margin="2,5,0,0" HorizontalAlignment="Center"&gt;
  
                              &lt;Grid.RowDefinitions&gt;
                                  &lt;RowDefinition Height="Auto"/&gt;
                                  &lt;RowDefinition Height="*"/&gt;
                              &lt;/Grid.RowDefinitions&gt;
  
                              &lt;Grid Grid.Row="0" HorizontalAlignment="Center"&gt;
  
                                  &lt;Grid.RowDefinitions&gt;
                                      &lt;RowDefinition Height="Auto"&gt;&lt;/RowDefinition&gt;
                                      &lt;RowDefinition Height="Auto"&gt;&lt;/RowDefinition&gt;
                                      &lt;RowDefinition Height="Auto"&gt;&lt;/RowDefinition&gt;
                                  &lt;/Grid.RowDefinitions&gt;
  
                                  &lt;Grid.ColumnDefinitions&gt;
                                      &lt;ColumnDefinition Width="10" /&gt;
                                      &lt;ColumnDefinition Width="Auto"/&gt;
                                      &lt;ColumnDefinition Width="*"/&gt;
                                  &lt;/Grid.ColumnDefinitions&gt;
  
                                  &lt;TextBlock Text="Item Name" FontFamily="Segoe UI" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="0" Grid.Column="1"
                           Margin="0,0,0,5"/&gt;
                                  &lt;TextBlock x:Name="ItemNameTextBlock"  Text="{Binding Path=ItemName,Mode=OneWay}" FontFamily="Segoe UI" FontWeight="DemiBold" VerticalAlignment="Top" 
                           HorizontalAlignment="Left" Grid.Row="0" Grid.Column="2" Margin="5,0,0,0"/&gt;
  
                                  &lt;TextBlock Text="Category" FontFamily="Segoe UI" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="1" Grid.Column="1"
                           Margin="0,0,0,5"&gt;&lt;/TextBlock&gt;
                                  &lt;TextBlock x:Name="CategoryTextBlock" Text="{Binding Path=Category.CategoryName,Mode=OneWay}" FontFamily="Segoe UI" FontWeight="DemiBold" VerticalAlignment="Top"
                           HorizontalAlignment="Left" Grid.Row="1" Grid.Column="2" Margin="5,0,0,0"/&gt;
  
                                  &lt;TextBlock Text="Item Quantity" FontFamily="Segoe UI" VerticalAlignment="Center" HorizontalAlignment="Right"  Grid.Row="2" Grid.Column="1"
                           Margin="0,0,0,5"&gt;&lt;/TextBlock&gt;
                                  &lt;TextBlock x:Name="ItemQuantityTextBlock" Text="{Binding Path=ItemQuantity,Mode=OneWay}" FontFamily="Segoe UI" FontWeight="DemiBold" VerticalAlignment="Top"
                           HorizontalAlignment="Left" Grid.Row="2" Grid.Column="2" Margin="5,0,0,0"/&gt;
  
                              &lt;/Grid&gt;
  
                              &lt;ListView x:Name="ItemIngredientsListView" Grid.Row="1" Margin="2,0,0,5" ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                ScrollViewer.VerticalScrollBarVisibility="Auto"&gt;
                                  &lt;ListView.Resources&gt;
                                      &lt;Style TargetType="{x:Type GridViewColumnHeader}" x:Key="MyHeaderStyle"&gt;
                                          &lt;Setter Property="FontFamily"  Value="Segoe UI Light"/&gt;
                                          &lt;Setter Property="FontWeight" Value="DemiBold"&gt;&lt;/Setter&gt;
                                          &lt;Setter Property="Height" Value="30"&gt;&lt;/Setter&gt;
                                      &lt;/Style&gt;
  
                                      &lt;Style x:Key="myHeaderStyle" TargetType="{x:Type GridViewColumnHeader}"&gt;
                                          &lt;Style.Triggers&gt;
                                              &lt;Trigger Property="IsMouseOver" Value="False"&gt;
                                                  &lt;Setter Property="Background" Value="#1570a6"/&gt;
                                                  &lt;Setter Property="Foreground" Value="#FFFFFF"/&gt;
                                              &lt;/Trigger&gt;
                                              &lt;Trigger Property="IsMouseOver" Value="True"&gt;
                                                  &lt;Setter Property="Foreground" Value="#000000"/&gt;
                                              &lt;/Trigger&gt;
                                          &lt;/Style.Triggers&gt;
                                      &lt;/Style&gt;
  
                                      &lt;local:BackgroundConverter x:Key="BackgroundKey"/&gt;
  
                                      &lt;Style x:Key="columnHeaderContianerStyle" TargetType="ListViewItem"&gt;
                                          &lt;Setter Property="Background"&gt;
                                              &lt;Setter.Value&gt;
                                                  &lt;Binding RelativeSource="{RelativeSource Self}" Converter="{StaticResource BackgroundKey}"/&gt;
                                              &lt;/Setter.Value&gt;
                                          &lt;/Setter&gt;
                                          &lt;!--&lt;EventSetter Event="PreviewMouseDown" Handler="ListViewItem_PreviewMouseDown"&gt;&lt;/EventSetter&gt;--&gt;
                                      &lt;/Style&gt;
  
                                  &lt;/ListView.Resources&gt;
                                  &lt;ListView.ItemContainerStyle&gt;
                                      &lt;Style TargetType="{x:Type ListViewItem}" BasedOn="{StaticResource columnHeaderContianerStyle}"&gt;
                                          &lt;Setter Property="HorizontalContentAlignment" Value="Center"/&gt;
                                          &lt;Style.Triggers&gt;
                                              &lt;Trigger Property="IsKeyboardFocusWithin" Value="True"&gt;
                                                  &lt;Setter Property="IsSelected" Value="True" /&gt;
                                              &lt;/Trigger&gt;
                                          &lt;/Style.Triggers&gt;
                                      &lt;/Style&gt;
                                  &lt;/ListView.ItemContainerStyle&gt;
                                  &lt;ListView.View&gt;
                                      &lt;GridView AllowsColumnReorder="true" ColumnHeaderContainerStyle="{StaticResource MyHeaderStyle}"&gt;
                                          &lt;GridViewColumn Header="Ingredient ID" Width="80" DisplayMemberBinding="{Binding Path=ItemIngredientID,Mode=OneWay}" 
                                            HeaderContainerStyle="{StaticResource myHeaderStyle}"/&gt;
                                          &lt;GridViewColumn Header="Ingredient" Width="200" DisplayMemberBinding="{Binding Path=IngredientName,Mode=OneWay}" 
                                            HeaderContainerStyle="{StaticResource myHeaderStyle}"/&gt;
                                      &lt;/GridView&gt;
                                  &lt;/ListView.View&gt;
                              &lt;/ListView&gt;
                          &lt;/Grid&gt;
                      &lt;/GroupBox&gt;
  
                  &lt;/Grid&gt;
              &lt;/Grid&gt;
  
          &lt;/Grid&gt;
      &lt;/ScrollViewer&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p>May be I am posting huge xaml, because I am not sure where exactly went wrong in the whole user control.</p>
  
  <p>Some one, please look into my xaml and tell me where exactly do I need to change the rowHeight or some thing else.</p>
  
  <p>Any help highly appreciated.</p>