简体   繁体   中英

UWP ListView takes more than available height

In my FluentTorrent app I want to have a file list inside a listview item that contains a torrent. So the child of a listview is a Pivot which, among others, has this 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> 
....

The problem is that this file-list containing listview height goes beyond the available height when the torrent has too many files. There is no scroll bar so many of the files are not visible (only these that would fit the space taken by the height of the entire window are visible).

Is there a way to tell the listview item (a StackPanel) that its available height should be automatically adjusted? The main ListView takes the whole HWND height anyway.

You could try to enforce the height of your Grid row:

<Grid.RowDefinitions>
  <!-- full size row -->
  <RowDefinition Height="*" x:Name="RowDef2" />
</Grid.RowDefinitions>

--- disclaimer: I am not particular sure since it might depend on your full page's layout.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM