Frage

I created an Animation on my Windows Phone 8 app

but i don't know how to make a button Disabled or Disappear when the Animation is executing

and when it finishes , the button will be Enabled or Visible again

So where should i add a code that makes the Button disabled ?

My animation code :

 //h1 is the animation picture 
  private void h2_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {


            Duration Time_duration2 = new Duration(TimeSpan.FromSeconds(2));

            Storyboard MyStory2 = new Storyboard();

            MyStory2.Duration = Time_duration2;

            DoubleAnimation My_Double2 = new DoubleAnimation();

            My_Double2.Duration = Time_duration2;

            MyStory2.Children.Add(My_Double2);

            RotateTransform MyTransform2 = new RotateTransform();

            Storyboard.SetTarget(My_Double2, MyTransform2);

            Storyboard.SetTargetProperty(My_Double2, new PropertyPath("Angle"));

            My_Double2.To = 180;

            h2.RenderTransform = MyTransform2;

            h2.RenderTransformOrigin = new Point(0.5, 0.5);

            MyStory2.Begin();

        }

UPDATE : I added pass.IsEnabled = false; after MyStory2.Begin();

so now when i press at the Animation the Button is Disabled , but when it Finishes the button should be back to Enabled , so where do i put pass.IsEnabled = true; ?

War es hilfreich?

Lösung

so now when i press at the Animation the Button is Disabled , but when it Finishes the button should be back to Enabled , so where do i put pass.IsEnabled = true; ?

The Storyboard has a Completed event. Just subscribe to it, and set the value of IsEnabled when the event is raised.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top