C#WPF设计器异常:动画对象不能用于设置属性';前景';
下面的代码在运行时运行得很好,但使设计器崩溃,我不知道为什么C#WPF设计器异常:动画对象不能用于设置属性';前景';,c#,wpf,exception,animation,wpf-4.0,C#,Wpf,Exception,Animation,Wpf 4.0,下面的代码在运行时运行得很好,但使设计器崩溃,我不知道为什么 <VisualState x:Name="Selected" > <Storyboard> <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="HeaderTopSelecte
<VisualState x:Name="Selected" >
<Storyboard>
<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="HeaderTopSelected">
<EasingColorKeyFrame KeyTime="0" Value="White"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
这会使设计器崩溃,并出现以下错误:
'System.Windows.Media.Animation.ColorAnimationUsingKeyFrames'
动画对象不能用于设置属性“前景”的动画
因为它是不兼容的类型“System.Windows.Media.Brush”
我已经花了好几个小时试图弄明白这一点,我只是不知道为什么考虑到这个例子的设计师会在网上多次出现这种崩溃,并在运行时工作
谁能告诉我我做错了什么
谢谢 您可能必须使用以下语法:
Storyboard.TargetProperty="(TextBlock.Foreground).Color"
“前景”和“SolidColorBrush”是同一个对象。我两年前就退出了设计师的工作:)工作得很好,非常感谢。特里,我不在乎社会是否还没有完全接受我现在对你的爱。我仍然会在屋顶上高喊+1.