I\'m trying to display a list of bound items. I\'ve customized the datatemplate to be a grid and I want the right column (that has a fixed width) to stick to the right side
I was just attempting to get my ListView to stretch properly and found this answer. I'm using Visual Studio 2017 and working on a UWA (Universal Windows App) project.
I'm altering the default Grid element which was added by the project template and I couldn't get the ListView to stretch when it was added as a grid row / column.
I finally stumbled upon the XAML you can add directly to the ListView element:
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
It works great as you can see:
A friend helped me find this which means this question is now a duplicate since it's the same thing:
ListViewItem won't stretch to the width of a ListView
Just for clarity though, here was the takeaway code that solved my problem:
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
</Style>
</ListView.ItemContainerStyle>