For example, if you execute code at runtime to dynamically change Bart’s name to “Mandy”, the List Collection View will be unaware of that change and the item will update its view of the items.As a result, the changed item is no longer in the correct sort location or group. NET 3.5 or earlier, you can force a Collection View to be updated at runtime by calling its Refresh() method.

wpf listbox observablecollection not updating-9

Ok, if I measure the call to Refresh() it doesn’t take more than 100 ms or so, but like the call sets in motion alot of other things that will happen after my method has exited, which is understandable since the documentation states that the whole view is recreated and therefore I assume the whole tree of items of the visualtree concerned is re-created too. Since I’m a quidnunc I won’t be satisfied with this! First, let’s examine exactly what is happening in your scenario.

If I instead just remove the item, and just re-insert it, it’s as close as I can get to instantaneous. So I’m asking the great Dr, that has given us all such great in depth knowledge in the past, what can we do about this in a more generic fashion? What would you suggest I do if I have a collection of a type that I don’t know about at compile time? Dear Patient-X, I’ve been wondering what I could file under the letter ‘E’ in this series, and now you’ve afforded me the perfect opportunity! Understanding the List Collection View Class You are binding to a list of items.

No, you are not lost in your path to enlightenment. More specifically, you are binding to a collection of Person objects (namely an Observable Collection) that, in turn, implements the IList interface.

The binding engine will automatically generate a List Collection View for such a collection.

The List Collection View class provides support for sorting, grouping, and filtering your collection when it is the Items Source for an Items Control.

(See When this Collection View Source is set as the Items Source of a List Box, it will yield a view of the collection (namely, a List Collection View) in which the characters are grouped by gender and sorted by first name.Here is what the List Box declaration might look like: The image below depicts our List Box with grouping and sorting.You can download the sample for this post to see the complete item template, item container style, and group item style.Dynamically Updating Items is Problematic Ideally, applying a sort order to a Collection View would result in a grouped and sorted view of the collection that is fully maintained even when items within the collection are changed.Unfortunately, a List Collection View only groups and sorts its items when the view is first created (or when new items are added to the source collection, assuming that the source collection is observable).A List Collection View will *not* monitor changes to properties on each existing item within the collection.