Ken
Ken

Reputation: 369

Unable to get Itemssource to update ListBox

I have a WPF ListBox, and I am setting its itemssource in codebehind to a List. Works fine the first time, but afterwards I create an updated List, assign myListBox.itemssource = the_new_list, and the list still displays the original list. I've done this sort of thing with data views before, but they have a Refresh() method which allows the new values to appear. How can I tell my ListBox that it's itemssource has been changed and to display the new values?

Upvotes: 0

Views: 216

Answers (1)

Stefan Z Camilleri
Stefan Z Camilleri

Reputation: 4076

Instead of setting the itemssource directly, bind it to a property and update the property with your new itemssource.

Upvotes: 1

Related Questions