我有一个故事板,它似乎自行随机停止,我一生都无法弄清楚原因。
它似乎停止和随机间隔。
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() 。
如果有人遇到此问题或可以帮助我调试它,我将非常感激。