After adding a ListView
inside a Grid
, it doesn't scroll vertically for some reason. I've placed the ListView
inside a ScrollViewer
then taken it out again and that still didn't make a difference. What needs to be done to fix this and add a vertical scroll bar so the user is aware that all content can't fit their screen?
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<TextBlock x:Uid="Header" Style="{StaticResource HeaderTextBlockStyle}" />
<TextBlock Text="SubHeader" Style="{StaticResource SubheaderTextBlockStyle}"/>
</StackPanel>
<ListView Grid.Row="1"
ItemsSource="{x:Bind listItems}"
SelectionChanged="ListView_SelectionChanged">
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Title}"
Style="{StaticResource TitleTextBlockStyle}" />
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
UPDATE
<Page
x:Class="MyApp.ContactPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<TextBlock x:Uid="Header" Style="{StaticResource HeaderTextBlockStyle}" />
<TextBlock Text="SubHeader" Style="{StaticResource SubheaderTextBlockStyle}"/>
</StackPanel>
<ListView
Grid.Row="1"
ItemsSource="{x:Bind listItems}"
SelectionChanged="ListView_SelectionChanged">
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Title}"
Style="{StaticResource TitleTextBlockStyle}" />
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
</Page>