我在Visual Studio中创建了一个项目,然后在Blend中将其打开,以便可以制作一些动画。从项目启动时启动Stop StoryBoard
我使用StoryBoard创建了两个动画,并将每个动画关联到不同的按钮(在Clic动作中)。
我的问题是,两个动画开始时,我启动应用程序,我想要做的就是阻止他们,直到按钮被触发。
我该如何做到这一点?
EDIT
这是我的源代码。
<s:SurfaceWindow.Resources>
<Storyboard x:Key="StoryboardStart" x:Name="SBStrt">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="image">
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="StoryboardStop" x:Name="STStp">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="image">
<EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
而且在构造函数中的.cs我有这个
public SurfaceWindow1()
{
InitializeComponent();
// Add handlers for window availability events
AddWindowAvailabilityHandlers();
}
查看我的更新。 –
我不支持,但是:你可以尝试将RepeatBehavior设置为“0x”或“0:0:0”。像这样:DoubleAnimationUsingKeyFrames上的RepeatBehavior =“0x”。欲了解更多信息:http://msdn.microsoft.com/en-us/library/system.windows.media.animation.repeatbehavior%28v=vs.95%29.aspx – RTB
如果我的答案有帮助,请接受它。如果不是问题的现状如何?也许我可以帮助你。 – RTB