Dear all,
I have the following code snipet
_TagWorker.RunWorkerCompleted += (sender, e) => { if (e.Result != null) { Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { TagImage = e.Result as BitmapSource; TagLoaded = true; })); } else { //Display failed image } };
From that code, executed from a viemmodel, I am getting the e.result of a worker thread into a TagImage which is an ImageSource.
The TagImage is directly bind to an Image source property in my WPF view. At the time the TagImage get updated I get an exception that says "Must create DependencySource on same Thread as the DependencyObject."
Why the error comes, I am executed the update in the application Dispatcher ?
Any idea how to solve ?
regards