When I was working on the SyncCopy, I was troubled by the fact that listviewcolumn does not resize its width when new items are added to the listview. You can manually adjust the width of the columns by double click on the border line of each column, or just drag the column to the desired length.
To resize columns programmatically, you can do the following (assuming your listview/gridview is called gridView):
However, when I was trying to refractor/rewrite SyncCopy to use MVVM pattern, this way of doing resizing columns is kind of violating the guideline of MVVM design pattern. I know I can use attached properties in WPF and write a custom property that automatically resize the columns when needed, but I got stuck on when to and what event to hook into in order to execute the code above for programmatically resizing the listview on runtime.
Fortunately I came across this excellent blog post in Delay’s Blog :