Zee99
Zee99

Reputation: 1234

Silverlight 3 Control Animation - Fade In then Fade out in same animation

Control type is Border, Control name is brdMessage. How can i make a storyboard to fade in my control (opacity from 0 to 1) in the first 3 seconds, then nothing happens in the next 3 seconds and then a fade out (opacity from 1 to 0) the control in the following 3 seconds? (can you please provide answers in c# code and not xaml). Thanks.

Upvotes: 1

Views: 995

Answers (1)

Zee99
Zee99

Reputation: 1234

I figured it out with the autoreverse , however, how to pause it before reversing?

    Storyboard sb = new Storyboard();
    DoubleAnimation da = new DoubleAnimation();
    da.To = 1;
    da.Duration = new Duration(TimeSpan.FromSeconds(3));
    sb.Children.Add(da);
    Storyboard.SetTarget(da, brdStatus);
    Storyboard.SetTargetProperty(da, new PropertyPath("Opacity"));
    txtMessage.Text = msg;
    sb.AutoReverse = true;
    sb.Begin();

Upvotes: 1

Related Questions