在关闭主窗口之前我有一个动画,如下面的代码所示。问题是StoryBoard.Completed
没有开火。任何线索是什么原因造成的?
代码
DoubleAnimation dblAnimX = new DoubleAnimation(1.0, 0.0, new Duration(TimeSpan.FromSeconds(0.5)));
dblAnimX.SetValue(Storyboard.TargetProperty, this);
DoubleAnimation dblAnimY = new DoubleAnimation(1.0, 0.0, new Duration(TimeSpan.FromSeconds(0.5)));
dblAnimY.SetValue(Storyboard.TargetProperty, this);
Storyboard story = new Storyboard();
Storyboard.SetTarget(dblAnimX, this);
Storyboard.SetTarget(dblAnimY, this);
Storyboard.SetTargetProperty(dblAnimX, new PropertyPath("RenderTransform.ScaleX"));
Storyboard.SetTargetProperty(dblAnimY, new PropertyPath("RenderTransform.ScaleY"));
story.Children.Add(dblAnimX);
story.Children.Add(dblAnimY);
story.Begin(this);
story.Completed += (o, s) => { this.Close(); };