I am running some animations from code behind that animate Opacity of an element. There are two animations, one is reducing Opacity from current value to 0 and other is increasing Opacity from current value to 1. The problem is that it could happen that one of these animations might be started while the previous one is not done... so they are both changing the Opacity property at the same time and that looks bad. What I need instead is to stop any current animation (storyboard) before I start the next animation of these animations. I hope I was clear enough... So the question is basically, for a given element how can I get active Storyboard/Animations in order to stop them? This is for code behind question since it seems that XAML defined animations do this automatically.
2
votes
1 Answers
0
votes
I believe you want to use SkipStoryboardToFill to have the current storyboard skip to the end, then run the next. Regardless see How to: Use Event Triggers to Control a Storyboard After It Starts or How to: Control a Storyboard After It Starts to process these in your codebehind which you have currently.