Storyboard Animation
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.
-
-
sfernandez
Site Admin
- Posts: 2908
- Joined:
Re: Storyboard Animation
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:
2) If you start the storyboard from code, remember to set the controllable flag to true:
Then you can stop the animation using a trigger action:
Or from code:
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:
Code: Select all
<EventTrigger RoutedEvent="Button.Click" SourceName="buttonBegin">
<BeginStoryboard Name="animSB" Storyboard="{StaticResource anim}"/>
</EventTrigger>
Code: Select all
animStoryboard.Begin(targetElement, targetElement, true);
Code: Select all
<EventTrigger RoutedEvent="Button.Click" SourceName="buttonStop">
<StopStoryboard BeginStoryboardName="animSB" />
</EventTrigger>
Code: Select all
animStoryboard.Stop(targetElement);
Who is online
Users browsing this forum: No registered users and 7 guests