我正在尝试在多边形的fill属性上执行颜色动画并获取此错误 - 无法将属性“Style”中的值转换为“System.Windows.Style”类型的对象。无法解析属性路径“Fill.Color”中的所有属性引用。验证适用的对象是否支持该属性。标记文件中对象'System.Windows.Shapes.Polygon'出错。
有什么想法吗?请看下面我的XAML风格。感谢。
<Style TargetType="{x:Type Polygon}" x:Key="ArrowStyle">
<Style.Triggers>
<DataTrigger Value="True">
<DataTrigger.Binding>
<MultiBinding Converter="{StaticResource NumberIsLessThanParameter}">
<Binding Path="Value" Mode="OneWay"/>
<Binding Path="OldValue" Mode="OneWay"/>
</MultiBinding>
</DataTrigger.Binding>
<DataTrigger.EnterActions>
<BeginStoryboard Name="ToRedArrow">
<Storyboard TargetProperty="Fill.Color">
<ColorAnimation From="Transparent" To="Red" Duration="0:0:2" AutoReverse="False" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
</DataTrigger>
<DataTrigger Value="False">
<DataTrigger.Binding>
<MultiBinding Converter="{StaticResource NumberIsLessThanParameter}">
<Binding Path="Value" Mode="OneWay"/>
<Binding Path="OldValue" Mode="OneWay"/>
</MultiBinding>
</DataTrigger.Binding>
<DataTrigger.EnterActions>
<BeginStoryboard Name="ToBlueArrow">
<Storyboard TargetProperty="Fill.Color">
<ColorAnimation From="Transparent" To="Blue" Duration="0:0:2" AutoReverse="False"/>
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
</DataTrigger>
</Style.Triggers>
</Style>
答案 0 :(得分:0)
属性路径看起来无效。尝试将其更改为:(Shape.Fill).(SolidColorBrush.Color)