如何使用 Expression Blend 在页面加载时自动播放故事板动画

发布于 2024-11-07 02:06:06 字数 118 浏览 0 评论 0原文

我有一个故事板,应该在页面加载时播放。有没有办法直接从 Expression Blend 做到这一点?我宁愿不通过代码或 xaml 来完成它。

对按钮点击或其他事件做同样的事情怎么样?

谢谢

I've got a storyboard that should play when a page loads. Is there any way to do that directly from Expression Blend? I'd rather not do it through code or xaml.

What about doing the same for button clicks or other events?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

灯下孤影 2024-11-14 02:06:06

您可以将 ControlStoryboardAction 行为(Assets->Behaviors)拖到页面上,并将 EventName 设置为 PageLoaded,ControlStoryboardOption 设置为 Play,Storyboard 到你的故事板。

You can drag the ControlStoryboardAction behaviour (Assets->Behaviors) over to the Page, and set the EventName to be PageLoaded, and ControlStoryboardOption to Play, and Storyboard to your storyboard.

清风无影 2024-11-14 02:06:06

如果您决定通过代码执行此操作,那么您只需调用 StoryBoard 的 Begin() 即可。例如:

<Storyboard x:Name="fadeIn">
        <DoubleAnimation Storyboard.TargetName="img"
                         Storyboard.TargetProperty="Opacity" From="0.0"
                         To="1.0" Duration="0:0:1" />
    </Storyboard>


private void btnFadeIn_Click(object sender, RoutedEventArgs e)
{
    this.fadeIn.Begin();
}

If you decide to do this via code then all you need to do is just to call Begin() of the StoryBoard. Like for example:

<Storyboard x:Name="fadeIn">
        <DoubleAnimation Storyboard.TargetName="img"
                         Storyboard.TargetProperty="Opacity" From="0.0"
                         To="1.0" Duration="0:0:1" />
    </Storyboard>


private void btnFadeIn_Click(object sender, RoutedEventArgs e)
{
    this.fadeIn.Begin();
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文