在制作简单动画时遇到“无法解析属性路径‘fill.color’中的所有属性引用,请确认适用的对象支持这些属性“的问题;
<Storyboard x:Key="AlarmWarnningAnimation"> <ColorAnimation Storyboard.TargetProperty="Fill.Color" To="#3FFF0000" Duration="0:0:0.3" RepeatBehavior="Forever" AccelerationRatio="0.3" DecelerationRatio="0.3" AutoReverse="True"/> </Storyboard>
查了不少资料,总算找到解决办法了(http://www.haogongju.net/art/401126),感谢这篇文章的作者;
1 <Storyboard x:Key="AlarmLegendAnimation"> 2 <ColorAnimation To="#3FFF0000" Duration="0:0:0.3" RepeatBehavior="Forever" 3 Storyboard.TargetProperty="(Rectangle.Fill).Color" 4 AccelerationRatio="0.3" DecelerationRatio="0.3" 5 AutoReverse="True"/> 6 </Storyboard>
区别就是,在设定StoryBoard的TargetProperty时,要加上UIElement才能正常使用