[ACCEPTED]-WPF ListBox not updating with the ItemsSource-listbox
Is your m_VariableList implementing INotifyCollectionChanged? If 3 it's not an ObservableCollection, then changes 2 to it's contents will not automatically 1 be reflected in the UI.
The problem is not in the XAML that you 11 have provided. I used the same XAML successfully 10 in a test application; however, I was able 9 to replicate the issue you are experiencing 8 by re-instantiating the m_VariableList variable.
When 7 the m_VariableList is given a new instance, or 6 pointed to a new object, it is not reflected 5 in the ListBox because the control has its 4 own reference to the data. This may not 3 be the cause of your problem, but I'd recommend 2 looking over your code-behind to ensure 1 that the variable is not getting re-instantiated.
i got stuck for more than hour and then 3 simple logic solved this problem just set 2 itemsource to clear list and then set source 1 u need again
lstVariable_Selected.ItemsSource = new List<Object>();
lstVariable_Selected.ItemsSource = m_VariableList;
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.