Since you create you BitmapImage
on a worker thread, it's not owned by the WPF thread.
Maybe this code can help you to solve the issue:
The code you posted
ThreadStart thread = delegate()
{
BitmapImage image = WebService.LoadImage(data, Dispatcher.CurrentDispatcher);
Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() =>
{
this.Image = image;
}));
};
new Thread(thread).Start();
How you could change your WebService.LoadImage
to "make it work"
BitmapImage LoadImage(object data, Dispatcher dispatcher)
{
// get the raw data from a webservice etc.
byte[] imageData = GetFromWebserviceSomehow(data);
BitmapImage image;
// create the BitmapImage on the WPF thread (important!)
dispatcher.Invoke(new Action(()=>
{
// this overload does not exist, I just want to show that
// you have to create the BitmapImage on the corresponding thread
image = new BitmapImage(imageData);
}));
return image;
}