: 'Cannot animate 'Fill.Color' on an immutable object instance.'

前端 未结 1 645
执笔经年
执笔经年 2021-01-27 23:13

I\'m new to WPF and I\'m mm trying to animate a shape to a "Flashing red" color animation in case I get some trigger value. Here is my relevant XAML code:



        
相关标签:
1条回答
  • 2021-01-27 23:21

    Create a new SolidColorBrush as value for the Fill Setter:

    <Style TargetType="Rectangle">
        <Setter Property="Fill">
            <Setter.Value>
                <SolidColorBrush Color="{Binding AlertUnit.AlertColor.Color}"/>
            </Setter.Value>
        </Setter>
        ...
    </Style>
    
    0 讨论(0)
提交回复
热议问题