开发者

WPF - Color animation on Polygons

开发者 https://www.devze.com 2022-12-21 14:06 出处:网络
I\'m trying to perform a color animation on the fill property of a polygon and getting this error - Cannot convert the value in attribute \'Style\' to object of type \'System.Windows.Style\'. Cannot

I'm trying to perform a color animation on the fill property of a polygon and getting this error - Cannot convert the value in attribute 'Style' to object of type 'System.Windows.Style'. Cannot resolve all property references in the property path 'Fill.Color'. Verify that applicable objects support the properties. Error at object 'System.Windows.Shapes.Polygon' in markup file.

Any ideas? Please see below my XAML style. Thanks.

<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="OldV开发者_JAVA百科alue" 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>


Property path looks invalid. Try to change it to: (Shape.Fill).(SolidColorBrush.Color)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号