【发布时间】:2010-12-21 11:49:49
【问题描述】:
我的故事板似乎会自行随机停止,我终其一生都无法弄清楚原因。
它似乎停止和随机间隔。
private void CreateStoryboard(int from)
{
int? targetTo;
Duration dur;
targetTo = 150;
dur = 150;
Int32Animation element = new Int32Animation();
element.From = from;
element.To = targetTo;
element.Duration = dur;
Storyboard.SetTargetProperty(element, new PropertyPath(CurrentFrameProperty));
_filmstripStoryboard = new Storyboard {SpeedRatio = this.FrameRate};
_filmstripStoryboard.Children.Add(element);
_filmstripStoryboard.Completed += new EventHandler(FilmstripStoryboard_Completed);
_filmstripStoryboard.Begin(this, true);
}
如您所见,我影响了自定义“CurrentFrameProperty”DP,它有一个回调方法,我打印出当前帧。
出于某种原因,我只是不知道为什么,故事板就停止了。完成的事件不会被触发,并且回调方法停止被调用。
而且我确信我不会在任何地方调用 stop()。
如果有人遇到过这个问题或者可以帮我调试一下,我将不胜感激。
【问题讨论】:
标签: wpf animation storyboard