Jonny
Jonny

Reputation: 2927

WPF access Label from different threads

I am using WPF for the first time. In my program I have a label which I would like to change it's text from another thread. However I can't really find anything related to this.

Thank you in advance for your help!

Upvotes: 0

Views: 1451

Answers (1)

Chris Shain
Chris Shain

Reputation: 51329

In WPF, as in Winforms, you may not access UI components from anything other than the UI thread.

You should use the dispatcher to access the UI from a background thread. This article is a good primer: http://msdn.microsoft.com/en-us/magazine/cc163328.aspx

Upvotes: 3

Related Questions