How to directly access the UI thread from the BackgroundWorker thread in WPF?

后端 未结 3 1745
一个人的身影
一个人的身影 2021-01-15 09:49

I\'m creating a backup utility in WPF and have a general question about threading:

In the method backgroundWorker.DoWork(), the sta

3条回答
  •  执念已碎
    2021-01-15 10:16

    Have you looked at using Dispatcher.Invoke?

    Dispatcher.Invoke(new Action(() => { Button_Start.Content = i.ToString(); }));
    

    Or use BeginInvoke if you want something to happen asynchronously.

提交回复
热议问题