C# – How to force a WPF ListView to Requery its ItemSource


I'm rewriting its XML itemSource on the fly and want it to use the new data right away…

Best Solution

You should use an ObervableCollection. When this collection is updated, the ListView is updated.

But if for any reason you donĀ“t want to use one, use:



listView.ItemsSource = listView.ItemsSource;

Check A more elegant ListView requery for more info.