Avalon, the Dispatcher Thread and Databinding

by admin 2. December 2005 10:18

I've found an issue with the Avalon databinding. I have a library which updates itself in response to a FileSystemWatcher. The problem is that when I bind to this library it throws an exception when this update occurs because it the change doesn't happen on the Avalon dispatcher thread. I'm not sure how to get around this. I'm not directly involved in updating the UI since it's being done via databinding and the library has no knowledge of the UI so it can't redirect the update onto the dispatcher thread. Not sure where to go with this. My initial thoughts is that the databinding code should know how to move onto the dispatcher thread transparently.

System.NotSupportedException was unhandled
Message="This type of CollectionView does not support changes to its SourceCollection from a thread different from the Dispatcher thread."
at System.Windows.Data.CollectionView.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedAction action, Object item, Int32 index)
at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
at System.Collections.ObjectModel.Collection`1.Add(T item)
Comments are closed

About Us

RikWare is a software development company based in Brisbane, Australia. Led by director, Richard Mason, RikWare focusses on solving challenging business problems promptly and effectively.

RikWare is also the owner of Aussie Bushwalking, a free, wiki-like collaboration site for bushwalkers and the creator of RikMigrations, a migration framework for .NET.

Aussie Bushwalking

Want to discover some new bushwalking ideas? Share a few of your own? Aussie Bushwalking is like Wikipedia... but for bushwalkers. Head on over. Anybody can see the walks and it's free to sign up and share your own.



RikMigrations is a database migration library for .NET based on the migrations facility provided by Ruby on Rails. It allows simple upgrading and downgrading of databases using .NET code (such as VB or C#) either from the command line or built into your application. Unlike many other migration frameworks, RikMigrations is a stand-alone library which does not rely on a large surrounding framework.