Topic Author
Posts: 41
Joined: 07 May 2014, 19:41

Storyboard Animation

10 Jun 2014, 21:00

Is there a way to reset the storyboard to the beginning upon completion? I don't want it to reverse the animation back just simply set it back to where it was at the beginning instantly.
User avatar
Site Admin
Posts: 2056
Joined: 22 Dec 2011, 19:20

Re: Storyboard Animation

12 Jun 2014, 21:15

If you launch the storyboard as controllable, then you can stop it whenever you want, so animation is reset to the initial state.

To start the storyboard as controllable you have 2 options:

1) If using a BeginStoryboard trigger action, you have to set the BeginStoryboard.Name property:
<EventTrigger RoutedEvent="Button.Click" SourceName="buttonBegin">
    <BeginStoryboard Name="animSB" Storyboard="{StaticResource anim}"/>
2) If you start the storyboard from code, remember to set the controllable flag to true:
animStoryboard.Begin(targetElement, targetElement, true);
Then you can stop the animation using a trigger action:
<EventTrigger RoutedEvent="Button.Click" SourceName="buttonStop">
    <StopStoryboard BeginStoryboardName="animSB" />
Or from code:

Who is online

Users browsing this forum: No registered users and 0 guests