Reputation: 369
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
Reputation: 4076
Instead of setting the itemssource directly, bind it to a property and update the property with your new itemssource.
Upvotes: 1