Reputation: 127
I'm new in wpf storyboard. I want you to ask if how can i play an animation after playing current animation with the use of conditional statement? Because i have buttons than needed to play (show them from screen) after the current animation is stop playing.
Upvotes: 0
Views: 2578
Reputation: 1021
Just try to call you animation, When and Where depends on your project
private void PlayStoryboard(string sb)
{
Storyboard StoryB = new Storyboard();
StoryB = (Storyboard)this.FindResource(sb);
StoryB.Begin();
}
Upvotes: 0
Reputation: 45135
In addition to JeremyK's answer, you may be able to do everything in a single storyboard by setting the start time of the next animation to the end time of the first animation.
Upvotes: 0
Reputation: 1103
While creating the animation you want to create a callback to Completed event.
...
System.Windows.Media.Animation.Storyboard storyBoard = (System.Windows.Media.Animation.Storyboard)FindResource("storyboardName");
storyBoard.Completed += new EventHandler(storyBoard_Completed);
BeginStoryboard(storyBoard);
...
void storyBoard_Completed(object sender, EventArgs e)
{
System.Windows.Media.Animation.Storyboard storyBoard = (System.Windows.Media.Animation.Storyboard)FindResource("nextAnim");
BeginStoryboard(storyBoard);
}
Upvotes: 3