I've got a ListView and, for View = List, would like to have the list items fill up the entire width of the control. That is, when you click an item the whole row is highlighted.
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.
Anyone know how to do it?
You can bind the width of the ListViewItem
to the width of the ListView
:
...
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="Width" Value="{Binding ActualWidth, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListView}}}" />
</Style>
<ListView.ItemContainerStyle>
...
EDIT: you can set the ListView.FullRowSelect
property to true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With