我是故事板动画的新手,
Storyboard storyBoard = new Storyboard();
foreach (var segment in this.PieSegmentCollection)
{
DoubleAnimation angleAnimation = new DoubleAnimation() { From = StartAngle, To = EndAngle, Duration = new Duration(TimeSpan.FromSeconds(.8)) };
storyBoard.Children.Add(angleAnimation);
Storyboard.SetTargetProperty(angleAnimation, "PieSegment.EndAngleProperty");
Storyboard.SetTarget(angleAnimation, segment);
}
storyboard.Begin();
我尝试在PieSegmentCollection中为每个段设置动画,但是我收到了此错误
WinRT信息:无法解析TargetProperty (PieSegment.ArcEndAngleProperty)指定对象。
有人可以帮我解决这个问题吗?
答案 0 :(得分:1)
这个名称当然是EndAngle
,所以你应该这样设置目标属性:
Storyboard.SetTargetProperty(angleAnimation, "EndAngle");