Hello. I have a listView. When I open the window, I put the data in it:

listView.ItemsSource = _modelAuthor.Items; 

_modelAuthor.Items changes inside the program, and when changed, sends an event to this window.

How to update the contents of a listView ?

I tried it this way, but does not update anything, and when the window is resized, an error pops up:

The ItemsControl object does not match its source of items.

 private void ModelAuthorUpdated(object sender, ModelEventArgs<Author> e) { listView.ItemsSource = _modelAuthor.Items; } 

    1 answer 1

    Fixed using the Refresh method

      private void ModelAuthorUpdated(object sender, ModelEventArgs<Author> e) { listView.Items.Refresh(); }