WPF ListView垂直滚动条未显示
我正在列表视图上显示一组项目。集合足够长,可以显示ListView的垂直滚动条,但它不起作用 我的XAML:WPF ListView垂直滚动条未显示,wpf,xaml,scrollbar,Wpf,Xaml,Scrollbar,我正在列表视图上显示一组项目。集合足够长,可以显示ListView的垂直滚动条,但它不起作用 我的XAML: <UserControl> <Grid> <ListView ItemsSource="{Binding MyCollection}"> <ListView.View> <GridView> <GridV
<UserControl>
<Grid>
<ListView ItemsSource="{Binding MyCollection}">
<ListView.View>
<GridView>
<GridView.Columns>
<GridViewColumn DisplayMemberBinding="{Binding MyProperty}" Header="MyProperty" />
...
</GridView.Columns>
</GridView>
</ListView.View>
</ListView>
</Grid>
</UserControl>
...
My UserControl的使用方式如下:
<Window>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Menu Grid.Row="0" IsMainMenu="True">
<MenuItem Header="_File" />
...
</Menu>
<TabControl Grid.Row="1" >
<TabItem Header="myUserControl">
<views:MyUserControl />
</TabItem>
...
</TabControl>
...
</Grid>
</Window>
...
...
...
找到了它。
网格的高度
行
从“自动”
修改为“*”
问题是在哪里使用UserControl
。目前,您的UserControl
会将高度调整为ListView
,如果您指定,它会增长以容纳所有项目。更新了我的问题,并添加了我的用户控件的使用位置和方式。我已经遵循了您的示例,我的ListView
显示了垂直滚动条。您确定您的窗口
没有设置类似SizeToContent
的内容吗?ListView
是否显示所有项目或缺少某些项目?
<!-- Row where the ListView is shown -->
<RowDefinition Height="*" />