WPF的Resource可以相互作用吗
在resource中设置了一个coloranimation和一个brush,想用animation改变刷子的颜色,但是运行会报错,请问有什么解决方案
- HTML code
<UserControl.Resources> <SolidColorBrush x:Name="myBrush" Color="Gainsboro"></SolidColorBrush> <Storyboard x:Name="BrushChange"> <ColorAnimation RepeatBehavior="Forever" From="LightBlue" To="LightGray" Duration="0:0:01" Storyboard.TargetName="myBrush" Storyboard.TargetProperty="Color"> </ColorAnimation> <PointAnimation RepeatBehavior="Forever" From="20,20" To="180,180" Duration="0:0:20" Storyboard.TargetName="myPath" Storyboard.TargetProperty="Center"> </PointAnimation> </Storyboard> </UserControl.Resources>
[解决办法]