我的Windows应用商店故事板在异常后的10次中丢失了6次:
WinRT信息:同一个包含Storyboard的多个动画无法在单个元素上定位相同的属性。
代码:
private void Animate(int direction)
{
var storyboard = new Storyboard();
foreach (var item in _tableList)
{
var duration = new Duration(TimeSpan.FromMilliseconds(500));
var ease = new CubicEase { EasingMode = EasingMode.EaseOut };
var animation = new DoubleAnimation { EasingFunction = ease, Duration = duration };
if (direction == 0)
{
animation.From = 0;
animation.To = _perUserColumnWidth;
}
else
{
animation.From = _perUserColumnWidth;
animation.To = 0;
}
animation.EnableDependentAnimation = true;
Storyboard.SetTarget(animation, item);
Storyboard.SetTargetProperty(animation, "Width");
storyboard.Children.Add(animation);
}
storyboard.Begin();
}
我尝试了一切,但我无法正常工作。有没有人知道这方面的解决方案?
谢谢!