In my case I've solved the question doing this:
1.
I have a property "_gridView" which is the GridView object representing the view of a ListView whose name is "_listView".
<ListView x:Name="_listView">
<ListView.View>
<GridView x:Name="_gridView">
<GridViewColumn Header="Whatever"/>
</GridView >
</ListView.View>
</ListView>
2.
I haved added this other piece of code to updated the width of the columns of the GridView. This is based on this .NET reference of GridViewColumnHeader.
private void UpdateWidths()
{
foreach (var column in this._gridView.Columns)
{
column.Width = column.ActualWidth;
column.Width = Double.NaN;
}
}
3.
And in the constructor of the WPF window, I've inserted this other code to execute the update of the widths each time the "ItemsSource" of "_listView" changes.:
public MainWindow()
{
InitializeComponent();
DependencyPropertyDescriptor
.FromProperty(ListView.ItemsSourceProperty, typeof(ListView))
.AddValueChanged(_listView, (s, e) => {
UpdateWidths();
});
}
4.
Therefore, each time I change the "ItemsSource" property of the object "_listView" all the columns are updated.
_listView.ItemsSource = __New value__