Friday, October 26, 2007

timeline does not automatically play. Stop Timeline

Took me a long time to figure this one out!

When you create a new timeline, Blend creates by default an Event trigger which starts the animation when the scene is loaded.

Here is how you can delete it:-
open the Triggers palette- select the "Window.Loaded" event; (the bottom area of the palette will show all the actions for the "Window.Loaded" Event trigger)- click on the "-Trigger" button

In a similar way you can add an Event Trigger to start the animation when the button is clicked:- create the button- select the button- click on "+ Event"- select "button" in the first field (when button) and Click in the second field (in the end it will say: When button.Click is raised)- click on the "+" button- select Storyboard1.Begin as the action

You may also start the animation from code if you want: - add an Event in the property inspector OnButtonClick to the button - insert the following code (replace Storyboard1 with the name of your storyboard private void OnButtonClick(object sender, RoutedEventArgs e) { Storyboard storyboard = this.FindResource("Storyboard1") as Storyboard; storyboard.Begin(this); }

Thanks Adrian! You helped out a ton!

No comments: