我有一个listView,对于view=list,我想让列表项填充控件的整个宽度。也就是说,当您单击一个项目时,整行都将突出显示。
I can't find any setting in the ListView or ListViewItem to control this behavior, and padding with spaces doesn't work very well because I cannot rely on the text being fixed-width.
有人知道怎么做吗?
您可以绑定 ListViewItem 到…的宽度 ListView :
ListViewItem
ListView
... <ListView.ItemContainerStyle> <Style TargetType="ListViewItem"> <Setter Property="Width" Value="{Binding ActualWidth, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListView}}}" /> </Style> <ListView.ItemContainerStyle> ...
编辑:您可以设置 ListView.FullRowSelect
ListView.FullRowSelect