wpf - 在ListView中显示内容,文字被截断
问题描述
我在 ListView 中显示内容,文本被截断。即使此文本更长,也无法进一步移动水平滚动条。你知道如何解决这个问题吗?非常感谢你。
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Margin="20">
<ListView x:Name="ProductDetails"
ItemsSource="{Binding ProductDetailsCollection}"
HorizontalContentAlignment="Stretch"
VerticalAlignment="Stretch"
/>
</Grid>
解决方案
要解决此问题,您可以Style
在窗口中创建一个新的,如下所示:
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="Width" Value="Auto" />
</Style>
它应该调整文本并防止被切断。
如果您已经为您ListView
或您的ListViewItem
支票提供了自定义样式,那么您不会像我发布的那样覆盖属性
推荐阅读
- html - 如何更改垫子错误(角材料)的颜色?
- javascript - 在 React Native 中更改其他组件的状态
- angular - Firebase Web FCM 消息(messaging/use-public-key-before-get-token)
- bootstrap-4 - 如何使用引导程序创建网格
- dart - 如何阻止颤振视频播放器播放我的旧视频?
- angular - Angular 7 测试:NullInjectorError:ActivatedRoute 没有提供者
- numpy - 在同一数据数组上应用多个参数函数
- jenkins - 如何在詹金斯管道阶段视图中抑制 shell 命令输出?
- ruby - 如何使用 Ruby 和 RSpec 测试 HTTParty API 调用
- shell - Kill:AIX 7.1 上的无效信号