Asynchronous update to ObservableCollection items

With .Net 4.5, you can add support for background thread updates to an ObservableCollection by using BindingOperations.EnableCollectionSynchronization. This works great with MVVM.

See: BindingOperations.EnableCollectionSynchronization() equivalent for .net 4.0


If you are using WPF you are allowed to update properties on individual bound items and raise PropertyChanged from a background thread. The WPF data binding mechanisms (unlike the WinForms equivalent) detect this and marshal to the UI thread for you. There is a cost to this of course- using the automatic mechanism, each individual property update will cause a marshalling event, so if you are changing lots of properties performance may suffer, and you should consider doing the UI marshalling yourself as a single batch operation.

You are not allowed to manipulate collections however (add/remove items), so if your RSS feeds contain nested collections that you want to bind to you need to hoist the whole update to the UI thread ahead of time.


For this kind of application, I usually use a BackgroundWorker with ReportsProgress set to True. Then you can pass one object for each call as the userState parameter in the ReportProgress method. The ProgressChanged event will run on the UI thread, so you can add the object to the ObservableCollection in the event handler.

Otherwise, updating the properties from a background thread will work, but if you are filtering or sorting the ObservableCollection, then the filter will not be reapplied unless some collection change notification event has been raised.

You can cause filters and sorts to be reapplied by finding the index of the item in the collection (e.g. by reporting it as progresspercentage) and setting the list.item(i) = e.userstate, i.e. replacing the item in the list by itself in the ProgressChanged event. This way, the SelectedItem of any controls bound to the collection will be preserved, while filter and sorting will respect any changed values in the item.