【发布时间】:2011-11-16 22:18:02
【问题描述】:
我在 MainWindow 中有一个情节提要如下:
<Storyboard x:Key="OnMouseLeftButtonDown1">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" RepeatBehavior="Forever" DecelerationRatio="1" Storyboard.TargetName="ellipse">
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:2" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
在同一个窗口中,我有一个按钮来调用这个 StoryBoard 并同时打开一个新窗口,如下所示:
private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
{
Storyboard sb= this.Resources["OnMouseLeftButtonDown2"] as Storyboard;
if (sb != null)
sb.Begin(this);
Window2 win = new Window2();
win.Show();
}
现在当它显示 Window2 时,我想用按钮控件停止情节提要[“OnMouseLeftButtonDown2”],你有什么建议如何完成这一步吗?
塔恩斯克非常值得您关注,
干杯
【问题讨论】: