开发者

WPF access Label from different threads

开发者 https://www.devze.com 2023-03-02 16:40 出处:网络
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 a开发者_JS百科nother thread. However I can\'t really find anything related to this.

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 a开发者_JS百科nother thread. However I can't really find anything related to this.

Thank you in advance for your help!


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

0

精彩评论

暂无评论...
验证码 换一张
取 消