In a WPF application an ObservableCollection is filled and updated by LINQ to SQL queries. Then UI objects are updated using values from this ObservableCollection.
Is it possible and reasonable that operations of updating this ObservableCollection by LINQ to SQL queries were executed in a separate thread?
If yes, will, in this case, it be one and the same instance of this ObservableCollection? (I mean, if it is not the same one for taking values from LINQ datacontext and the one for giving values to update UI, then I will not be able to update UI)
With the built-in
ObservableCollection<T>class, you can’t change the content from a separate thread if the UI is bound to the collection, it throws aNotSupportedException(but change notification for properties of collection items works fine). I wrote anAsyncObservableCollection<T>class to handle this case. It works by invoking the event handlers on the UI synchronization context