ScrollViewer is not enabled for ListView

I have a control ListViewinside UserControl. But when the content overflows in size ListView, the vertical ScrollBarone is not included, despite its installation in XAML.

enter image description here

XAML is as follows:

<UserControl x:Class="GrandSuccessProject.View.ContactsView"
             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" 
             d:DesignHeight="367" d:DesignWidth="548" Background="{x:Null}" VerticalContentAlignment="Top">

<ListView ScrollViewer.CanContentScroll="True" 
          ScrollViewer.VerticalScrollBarVisibility="Visible" 
          ItemsSource="{Binding SelectedContacts}"  
          ItemContainerStyle="{StaticResource ContainerStyle}" 
          Grid.Row="1" 
          VerticalAlignment="Top" 
          VerticalContentAlignment="Top" />      

</UserControl>

I also tried grouping ListViewinside a ScrollViewer, but still doesn't work.

Thank you in advance :)

+5
source share
1 answer

It looks like

  • ListView takes all the space needed for all items, so scrolling is disabled.
  • ListView exceeds the boundaries of its containers.

, , , ListView, ? , .

+6

All Articles