在我的 FluentTorrent 应用程序中,我希望在包含 Torrent 的 ListView 项中有一个文件列表。所以 listview 的子项是一个 Pivot,其中有这个 PivotItem:
<PivotItem Header="Files" x:Name="PivotFiles">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" x:Name="RowDef2" />
</Grid.RowDefinitions>
<ListView Grid.Row="0" Grid.Column="0" x:Name="FilesView" SelectionMode="Extended" ScrollViewer.VerticalScrollBarVisibility="Visible" />
</Grid>
</PivotItem>
....
问题是当 torrent 文件太多时,这个包含 ListView 高度的文件列表超出了可用高度。没有滚动条,因此许多文件不可见(只有适合整个窗口高度所占空间的文件可见)。
有没有办法告诉 ListView 项(StackPanel)它的可用高度应该自动调整?无论如何,主 ListView 占据了整个 HWND 高度。
最佳答案
您可以尝试强制执行网格行的高度:
<Grid.RowDefinitions>
<!-- full size row -->
<RowDefinition Height="*" x:Name="RowDef2" />
</Grid.RowDefinitions>
---免责声明: 我不是特别确定,因为它可能取决于您整个页面的布局。
关于c++ - UWP ListView 占用的高度超过可用高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55535442/