我在UserControl
中有一个ListView
控件。但是,当内容超出ListView
的大小时,垂直ScrollBar
没有被启用,尽管在XAML中已经设置。
XAML如下:
<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>
我也尝试将
ListView
放在ScrollViewer
中分组,但仍然无法正常工作。非常感谢您的提前帮助 :)