简体   繁体   English

ListView不显示水平滚动条

[英]ListView Not Showing Horizontal Scrollbar

I have a ListView nested in a in a simple WPF app. 我有一个嵌套在简单WPF应用程序中的ListView。 I have the horizontal scrolling property enabled on the ListView, but it never activates so items continue to be truncated horizontally. 我在ListView上启用了水平滚动属性,但是它从未激活,因此项目继续被水平截断。 Hoping someone can point out any obvious errors. 希望有人指出任何明显的错误。 XAML: XAML:

<ListView Name="MyListView" ItemsSource="{Binding Path=SoftwareUpdates}" HorizontalAlignment="Left" MinHeight="55" Height="Auto" Margin="9,197,0,0" VerticalAlignment="Top" Width="570" Grid.RowSpan="2" Visibility="{Binding IsChecked,ElementName=DetailsCheckBox,Converter={StaticResource b2v}}" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto">
        <ListView.View>
            <GridView>
                <GridViewColumn Width="568" Header="Missing Updates:" DisplayMemberBinding="{Binding Path=Name}" />
            </GridView>
        </ListView.View>
    </ListView>

Changing the Width of the column to Auto (or equivalently, deleting the Width style, assuming there is no default style) gives the required result. 将列的“ Width ”更改为“ Auto (或等效地,假设没有默认样式,则删除“ Width样式)可提供所需的结果。

The key is that the data that you don't want to truncate is inside the column, which is truncated in the above code at Width 568... But this Width actually needs to be able to stretch indefinitely with the data so that it can be scrolled by the scroll bar on the ListView . 关键是您不想截断的数据在列中,在上面的代码中Width 568处被截断了...但是此Width实际上需要能够无限期地扩展数据,以便它可以由ListView上的滚动条滚动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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