Silverlight XAML arcsegment大小动画
我正在使用 Silverlight 4,尝试为 arcsegment 的 size 属性设置动画。我成功使用的唯一动画类型是 ObjectAnimationUsingKeyFrames。事实证明这很痛苦,所以我尝试对 size 属性的高度和宽度执行双重动画,但这不起作用。
<Path Stroke="Red" StrokeThickness="20">
<Path.Data>
<PathGeometry>
<PathFigure StartPoint="0,200">
<ArcSegment x:Name="ArcSeg1" Size="100,100" RotationAngle="0" IsLargeArc="True"
SweepDirection="Clockwise" Point="200,200" />
</PathFigure>
</PathGeometry>
</Path.Data>
</Path>
<DoubleAnimation
Storyboard.TargetName="ArcSeg1"
Storyboard.TargetProperty="Size.Width"
From="100"
To="50"
Duration="00:00:05"
/>
但这只会导致以下错误:
无法解析指定对象上的 TargetProperty Size.Width。
提前致谢。
I'm using Silverlight 4, trying to animate an arcsegment's size property. The only type of animation I've had success with is ObjectAnimationUsingKeyFrames. This turns out to be a pain, so I've tried doing a double animation on the height and width of the size property but that doesn't work.
<Path Stroke="Red" StrokeThickness="20">
<Path.Data>
<PathGeometry>
<PathFigure StartPoint="0,200">
<ArcSegment x:Name="ArcSeg1" Size="100,100" RotationAngle="0" IsLargeArc="True"
SweepDirection="Clockwise" Point="200,200" />
</PathFigure>
</PathGeometry>
</Path.Data>
</Path>
<DoubleAnimation
Storyboard.TargetName="ArcSeg1"
Storyboard.TargetProperty="Size.Width"
From="100"
To="50"
Duration="00:00:05"
/>
But this only results in the following error:
Cannot resolve TargetProperty Size.Width on specified object.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
虽然 Size 是一个 DependencyProperty(因此你可以为它设置动画),但 Size.Width 不是。 (宽度只是一个常规属性)
尝试为路径本身设置动画。
Although Size is a DependencyProperty (and hence u can animate it), Size.Width is not. (Width is just a regular property)
Try and animate the Path itself.