I have been playing around with the new async CTP and MVVM patterns. I have been converting an old program of mine that was using a background worker and report progress to update a collection in my model. I have converted it to something like so
TaskEx.Run(async () =>
{
while (true)
{
// update ObservableCollection here
}
await TaskEx.Delay(500);
});
In my view I bind to my viewmodel which exposes this observable collection. However, when my collection updates I get the following Exception
This type of CollectionView does not support changes to its SourceCollection from a thread different from the Dispatcher thread.
I'm not sure what the correct way to pull the is back to the UI thread when done like this.
async
in the Visual Studio 11 Developer Preview that you can download. – Styrax