For example I have an animation that triggers when mouse is clicked.
Problem is if you keep clicking the animation will restart.
I want to guarantee that an animation always plays through to completion.
Ideas?
For example I have an animation that triggers when mouse is clicked.
Problem is if you keep clicking the animation will restart.
I want to guarantee that an animation always plays through to completion.
Ideas?
One trick I've found is to not include the "From" on my animations. That way the values will always start at whatever value the property you're animating has right now. That means that if the animation restarts, it won't reset the property back to its starting value and will instead look like it's continuing the orginal animation.
Still not the exact answer you are looking for, but this solved a problem I had involving a MouseDown trigger that started a new animation on top of a still running one:
<BeginStoryboard>
<Storyboard AutoReverse="True">
<ColorAnimation Storyboard.TargetProperty="(Label.Foreground).(SolidColorBrush.Color)"
To="Red" Duration="0:0:1"/>
</Storyboard>
The problem with this animation is, that when it is triggered again before it completes, the autoreverse feature reverses it to the shade of red it had reached before it was triggered the second time, not to the original color it had before the first animation started.
In my case this was easily solved thus:
<BeginStoryBoard HandOffBehavior="Compose">