【问题标题】:Silverlight 3 Control Animation - Fade In then Fade out in same animationSilverlight 3 控制动画 - 在同一动画中淡入然后淡出
【发布时间】:2011-06-13 01:44:19
【问题描述】:

控件类型为Border,控件名称为brdMessage。我怎样才能使故事板在前 3 秒内淡入我的控件(不透明度从 0 到 1),然后在接下来的 3 秒内什么也没有发生,然后淡出(不透明度从 1 到 0)控件在接下来的 3秒? (您能否以 c# 代码而不是 xaml 提供答案)。 谢谢。

【问题讨论】:

    标签: animation


    【解决方案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();
    

    【讨论】:

      猜你喜欢
      • 2022-06-13
      • 1970-01-01
      • 2014-01-20
      • 2012-12-18
      • 1970-01-01
      • 2019-02-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多