[英]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. 我不知道我是否缺少一些明显的方法/属性,但在这里是:我有一个ProgressBar,默认情况下其属性IsIndeterminate为true。 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. 在SomeBackgroundWorker
DoWork()
方法的末尾。 Probably you will need Invoke()
to UI thread also. 可能还需要Invoke()
到UI线程。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.