UWP ListView 不固定,宽度变化

UWP ListView is not fixed and its width changes

我已经创建了一个列表视图,正如您在图像中看到的,listviewitem 不是固定的并且随着 TextBlock 文本而变化。

这是我的列表视图:

<ListView x:Name="listView"
                  ItemContainerStyle="{StaticResource ListViewItemWithoutHover}"
                  ItemsSource="{x:Bind SubtitlesACV, Mode=OneWay}"
                  ScrollViewer.HorizontalScrollBarVisibility="Auto"
                  ScrollViewer.HorizontalScrollMode="Enabled"
                  ScrollViewer.IsHorizontalRailEnabled="True"
                  SelectedIndex="-1"
                  SelectionMode="Single">
            <ListView.ItemTemplate>
                <DataTemplate x:DataType="model:SubsceneDownloadModel">
                    <usercontrol:SubsceneUserControl.../>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>

用户控件是:

<Grid MinHeight="68"
          Padding="0,0,16,0"
          HorizontalAlignment="Stretch"
          Background="{ThemeResource CardBackgroundBrush}"
          BorderBrush="{ThemeResource CardBorderBrush}"
          BorderThickness="{ThemeResource CardBorderThickness}"
          CornerRadius="{ThemeResource ControlCornerRadius}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="16" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="52" />
        </Grid.ColumnDefinitions>

        <StackPanel Grid.Column="1"
                    Margin="0,0,16,0"
                    VerticalAlignment="Center"
                    Orientation="Vertical">
            <TextBlock FontSize="16"
                       FontWeight="SemiBold"
                       Text="{Binding ElementName=subsceneView, Path=Title}"
                       TextWrapping="Wrap" />

            ....
        <StackPanel Grid.Column="2"
                    HorizontalAlignment="Right"
                    Orientation="Horizontal"
                    Spacing="8">
            <Button Name="DownloadButton"
                    Width="40"
                    Height="36"
                    Background="Transparent"
                    Click="DownloadButton_Click"
                    Content="&#xE896;"
                    FontFamily="Segoe MDL2 Assets">
                <ToolTipService.ToolTip>
                    <TextBlock Text="Download Subtitle" />
                </ToolTipService.ToolTip>
            </Button>

            ...
        </StackPanel>
    </Grid>

这是我的 ItemContainerStyle

<Style x:Key="ListViewItemWithoutHover" TargetType="ListViewItem">
        <Setter Property="Margin" Value="0,0,0,2"/>
        <Setter Property="Padding" Value="0,0,0,0"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
    </Style>

问题是,即使我为Textblock设置了TextWrapping="Wrap" 属性,它仍然导致listviewitem不稳定和变化。我希望listviewitem的宽度固定

删除这 2 行

ScrollViewer.HorizontalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollMode="Enabled"