I'm rewriting its XML itemSource on the fly and want it to use the new data right away...
Oscar Foley
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.InvalidateProperty(ListView.ItemsSourceProperty);
or
listView.ItemsSource = listView.ItemsSource;
Check A more elegant ListView requery for more info.
hmm...
listView.ItemsSource = listView.ItemsSource?
or you could trigger the PropertyChanged event on the property of your viewmodel in case you are using MVVM.
ListView.DataBind(); MSDN
来源:https://stackoverflow.com/questions/1111338/how-do-you-force-a-wpf-listview-to-requery-its-itemsource