Update progressbar from a backgroundworker in WPF

扶醉桌前 提交于 2019-12-04 13:52:08

In case you trying to change the UI content, you should put the calls on UI Dispatcher. You can't modify UI objects from background thread. Replace your lines with these -

App.Current.Dispatcher.Invoke((Action)delegate()
        {
            Title += j.ToString();
        });

and

App.Current.Dispatcher.Invoke((Action)delegate()
        {
            Title = "Done";
        });

You forgot to run the worker:

     worker.RunWorkerAsync();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!