【问题标题】:Storyboard does not start again故事板没有重新开始
【发布时间】:2012-01-11 00:50:28
【问题描述】:

我有一个在 silverlight 应用程序上运行良好的轮播,它来自这个网站: Carousel app

现在我想将其转换为 WPF 应用程序。这个问题是在 StoryBoard.Completed 事件中调用 storyboard.begin() 时,情节提要不会重新开始

private Storyboard timer;
public override void OnApplyTemplate()
{
this.timer.Completed -= new EventHandler(timer_Completed);
this.timer.Completed += new EventHandler(timer_Completed);
this.timer.Begin();
}
void timer_Completed(object sender, EventArgs e)
{
///Code to animate the carousel
this.timer.Begin();
}

情节提要在 OnApplyTemplate 中初始化,通过在 xaml 中定义的名称检索它

只发生一个 Completed 事件

感谢您的帮助

【问题讨论】:

    标签: wpf silverlight storyboard


    【解决方案1】:

    你从这里剪掉了一些代码吗?我猜它实际上并没有在 timer_Completed 结束时调用 Begin(),可能在那之前发生了一些异常。

    【讨论】:

    • 没有抛出异常,没有输出。完成时省略的代码不会引发任何异常(我也尝试过没有该代码)
    • 很奇怪我一直这样做......这行似乎有点奇怪:this.timer.Completed -= new EventHandler(timer_Completed);
    猜你喜欢
    • 2016-11-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-27
    • 1970-01-01
    • 2013-09-26
    • 2010-10-24
    相关资源
    最近更新 更多