2010-06-24 51 views
1

控件類型是邊框,控件名稱是brdMessage。我如何使故事板在前3秒內淡入我的控制(不透明度從0到1),然後在接下來的3秒內沒有任何反應,然後淡出(從1到0的不透明度)秒? (可否請您在c#代碼中提供答案,而不是xaml)。 謝謝。Silverlight 3控制動畫 - 淡入然後在同一動畫中淡出

回答

1

我想出了autoreverse,但是,如何在倒車之前暫停它?

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();