How Can I Update a WPF ListView?

E

EagleRed

I have an application with a WPF ListView that is bound to a
List<CustomObject>. I do some processing and the add a new CustomObject
instance to the List. How can I display the ListView with the newly added
item? I tried resetting the ItemSource and that did not work.

As always, any input will be helpful.

Thanks,
Eagle
 
E

EagleRed

Sometimes it is good to find an answer to your own question. A way to do
this is to set teh ItemSource to null and then reassign it. The follow
snippet shows and example with a WPF ListView, myListView with a
List<CustomObject>, customObjectList, set as the ItemSource.

customObjectList.Add(newCustomObject);
myListView.ItemSource = null;
myListView.ItemSource = customObjectList;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top