How to run a progress bar in different thread in WPF?

后端 未结 2 1937
囚心锁ツ
囚心锁ツ 2021-01-16 19:02

I am populating the list view items dynamically. At the same time I wanna display a progress bar. When data populated the progress bar should be disabled. How to achieve thi

2条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-16 19:38

    You can use the BackgroundWorker class, which simplifies the handling of background threads when you are working with WPF. There are plenty of examples on the web for this. Here two from codeproject, but it's easy to find more examples:

    http://www.codeproject.com/Tips/83317/BackgroundWorker-and-ProgressBar-demo.aspx http://www.codeproject.com/KB/cpp/BackgroundWorker_Threads.aspx

提交回复
热议问题