views:

1255

answers:

3

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

A: 

ListView.DataBind(); MSDN

Totty
That was one of the first things I tried. Your answer refers to a System.Web.UI.WebControls ListView, but the WPF ListView is System.Windows.Controls.ListView.
KevinDeus
A: 

hmm...

listView.ItemsSource = listView.ItemsSource?

or you could trigger the PropertyChanged event on the property of your viewmodel in case you are using MVVM.

Botz3000
+1  A: 

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 http://stackoverflow.com/questions/1406542/a-more-elegant-listview-requery for more info.

cad