0

When I try to do this:

progress.Visibility = Visibility.Visible; // it just a UI element
var t = Task.Run(() => this.CompareAll()); // CompareAll() is a time consuming operation
t.ContinueWith((result)=> { progress.Visibility = Visibility.Hidden;  });

I get the following error:

"The calling thread cannot access this object because a different thread owns it".

I think I have to use something related to Dispatcher but I'm not sure how. I'm using WPF. Any ideas?

jsanalytics
  • 13,058
  • 4
  • 22
  • 43

0 Answers0