Monday, September 17, 2012

How to stop storyboard animation in windows phone?

How to stop storyboard animation in windows phone?

I've made an animation with storyboard in Blend. The animation is in the MainPage and is very simple.

1) When my app starts, an image from the bottom of the screen moves at the top of the screen.

2) I also have a button at the MainPage. When i press it, it goes from the MainPage to the SecondPage.

When i'm on the SecondPage and i press the back button(the hard key on my cellphone) it goes to MainPage and the animation starts again. How can i stop this? I want the animation to play only when i start the application from scratch. Thanks in advance. :)

Answers & Comments...

Answer: 1

In your project find App.xaml.cs and edit the code inside this function

    private void Application_Launching(object sender, LaunchingEventArgs e)     {     } 

Add a boolean variable here say showanimation. And set it true.

On Mainpage, in the code behind, override OnNavigatedTo function and check for boolean value, if true then start animation else do nothing. Also dont forget to set the variable to false after starting animation. Hope it helps :)

by : Milan Aggarwalhttp://stackoverflow.com/users/1378956




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog