Hello,
I have a ListBox defined like:
<ListBox ItemsSource="{Binding Path=IngestGroups}" />
"IngestGroups" is a List<IngestGroup> object. All is well when the form loads and all the items are listed in the listbox. The problem comes when I need the listbox to be updated. When I click on one of the items, for example, the event calls my view model to make a change to the selected item's name. This means that one of the objects within the List<> gets updated. When the viewmodel does this it then calls NotifyPropertyChanged("IngestGroups") to have the listbox refreshed. The listbox does not update though. I can see that the UI asked for the list (via debug statement) but it did not update the listbox. I can only assume that WPF didn't think that the bound object (the List<>) had changed. If, however, I create a new List<> object in the viewmodel with all of the old list's objects, to include the one that changed, the listbox does get refreshed. Does anyone know why you have to go about creating an entirely new binding object in order to get the ListBox to see that a change has occurred?? Why doesn't it simply reload whatever object (ie the List<>) it gets after a NotifyPropertyChange is called. This seems overly cumbersome to have to do. Any thoughts on what is really happening?
Thanks - Peter