I have a ListView control where I want to resize the last column in sync with the size of the Window. So if the Window‘s width increases by 100 units, I want the columns’ width to also increase by 100.
Should I be using the Resize event on the Window and use a magic number to resize the column header manually, sort of like?:
columnHeader.Width = windowSize.X - 400;
I can’t take full credit for this answer, because I got it here
But basically this is the idea:
Replace the “View” in the listView with a GridView. Then, you can specify whatever width you want for the first columns. In this case 100, 50, 50.
Then we add a binding on the final column, that takes as input the parent ListView control. But we are allowing a converter to do the dirty work for us.
So, in the converter ‘Convert’ function we do this:
Which grabs the listview width, and calculates the new size.