Update UI Label when using Task.Factory.StartNew

后端 未结 2 1093
不思量自难忘°
不思量自难忘° 2020-12-14 02:38

I am trying to make my UI more responsive in my WPF app. I spawn a new thread using

Task.Factory.StartNew( () => RecurseAndDeleteStart() );
2条回答
  •  眼角桃花
    2020-12-14 03:30

    You have to use the label.Dispatcher.BeginInvoke(delegate) to invoke anything from a different thread that will change the contents of the label.

提交回复
热议问题