如何在WPF中的不同线程中运行进度条? [英] How to run a progress bar in different thread in WPF?

查看:216
本文介绍了如何在WPF中的不同线程中运行进度条?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在动态填充列表视图项。同时,我想显示进度条。填充数据后,应禁用进度条。如何实现这一目标。
我是WPF的新手。

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 this. I am new in WPF.

推荐答案

您可以使用BackgroundWorker类,该类简化了后台线程的处理。您正在使用WPF。
网上有很多例子。这是来自codeproject的两个,但是很容易找到更多示例:

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

这篇关于如何在WPF中的不同线程中运行进度条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆