I have a ListView that contains many items and am trying to set the column widths to auto so that they auto-expand to the width of the longest string in the column. At firs
The reason is that virtualization prevents some items from being generated, and then they are not considered for the calculation of the width.
So you can switch off the virtualization for the ListView with adding this to it ->
<ListView x:Name="lv" ScrollViewer.CanContentScroll="False">
But be careful it can slow down your app, if you have a lot of items, as they all will be generated at startup.