简体   繁体   中英

How to stop an indeterminate ProgressBar animation?

I don't know if i'm missing some obvious method/property, but here it is: I have a ProgressBar, which has the property IsIndeterminate as true by default. But I want it's animation only in a certain period. How can I achieve that? I tried something like:

SomeBackgroundWorker.DoWork += SomeBackgroundWorker_DoWork;
pgbStatus.IsIndeterminate = true;
btnUpdate.IsEnabled = false;
SomeBackgroundWorker.RunWorkerAsync();
btnUpdate.IsEnabled = true;
pgbStatus.IsIndeterminate = false;

But then it wouldn't move. Sorry if it's a duplicate(I have the feeling it is), but I couldn't find the answer anywhere.

Place

btnUpdate.IsEnabled = true;
pgbStatus.IsIndeterminate = false;

In the end of SomeBackgroundWorker DoWork() method instead. Probably you will need Invoke() to UI thread also.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM