【发布时间】:2020-08-18 20:14:15
【问题描述】:
我需要一个平滑的窗口透明度动画。我将此代码添加到窗口的“LOADED”事件中。
DoubleAnimation myDoubleAnimation = new DoubleAnimation();
myDoubleAnimation.From = 100.0;
myDoubleAnimation.To = 0.1;
myDoubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(1));
Storyboard.SetTargetName(myDoubleAnimation, Name);
Storyboard.SetTargetProperty(myDoubleAnimation, new PropertyPath(UIElement.OpacityProperty));
Storyboard myStoryboard = new Storyboard();
myStoryboard.Children.Add(myDoubleAnimation);
myStoryboard.Begin(this);
透明度急剧上升。缺少动画。哪里出错了?
【问题讨论】:
标签: c# wpf storyboard window transparency