Xamarin表单ProgressBar停止 [英] Xamarin Forms ProgressBar Stop
本文介绍了Xamarin表单ProgressBar停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Xamarin Forms中停止进度栏动画的最佳方法是什么?进展始于:
What is the best way to stop the progress bar animation in Xamarin Forms? Progress is started with:
animProgressBar = async () => {
...
await progressBar.ProgressTo (0, 10000, Easing.Linear);
...
};
我想停止动画并重新启动它.我尝试过类似的事情
I would like to stop the animation and restart it. I have tried things like
progressBar.AbortAnimation("ProgressTo");
没有成功.
推荐答案
我不确定是否可以取消ProgressTo
,我想创建自己的动画是最简单的解决方案:
I'm not sure that it is possible to cancel ProgressTo
and I suppose that creating own animation is easiest solution:
new Button
{
Text = "Kick progress bar",
Command = new Command(() =>
{
if (progressBar.AnimationIsRunning("SetProgress"))
{
progressBar.AbortAnimation("SetProgress");
}
else
{
progressBar.Animate("SetProgress",(arg) => { progressBar.Progress = arg; }, 8*60, 8*1000, Easing.Linear);
}
})
}
结果:
这篇关于Xamarin表单ProgressBar停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文