Wednesday, June 16, 2010

Sharing data with BackgroundWorker in C#/WPF

BackgroundWorker looked like a Good Thing, until I found that I couldn't pass it a BitmapSource because it "belonged to another thread." Even simple accesses to get the BitmapSource's state was not allowed.

After much stumbling and googling, I found that Freeze-ing an object allowed it to be shared between threads (which includes BackgroundWorker).

Problem solved!

No comments: