How to stop an animation in C# / WPF?

前端 未结 8 793
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-28 08:54

I have something like this:

barProgress.BeginAnimation(RangeBase.ValueProperty, new DoubleAnimation(
    barProgress.Value, dNextProgressValue,
    new Duration(T         


        
8条回答
  •  萌比男神i
    2020-11-28 09:31

    If you want the base value to become the effective value again, you must stop the animation from influencing the property. There are three ways to do this with storyboard animations:

    • Set the animation's FillBehavior property to Stop
    • Remove the entire Storyboard
    • Remove the animation from the individual property

    From MSDN

    How to: Set a Property After Animating It with a Storyboard

提交回复
热议问题