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?

Answers


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


Need Your Help

Scanning code base for use of deprecated methods

java eclipse deprecated eclipse-jdt

I've been tasked with developing a tool that scans a large collection of Java projects (~7000 .java files) for the use of deprecated methods/properties/APIs. It's been specified that the tool scans...

How can a UIElement be moved programatically?

wpf move uielement

If I have a a button control and want to move it 10 pixels left repeatedly by clicking another button.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.