How to stretch listview items width to fill parent container?
The default behaviour seems to be squishing everything as narrow as possible.
The problem is not with the child item but with the itemcontainer which has a HorizontalAlignment=Left hidden somewhere deep inside the framework code. Only after fixing this will you get the behaviour one would expect to be there by default.
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>
</ListView.ItemContainerStyle>
<GroupStyle.HeaderContainerStyle >
<Style TargetType="ListViewHeaderItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>
</GroupStyle.HeaderContainerStyle>
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