这些静态资源我在不同的地方使用,每个设计。现在我想在故事板中使用静态资源进行着色,但我无法使其正常工作,我得到了错误:
An object of the type "System.Windows.Media.SolidColorBrush" cannot be applied to a property that expects the type "System.Nullable1[[System.Windows.Media.Color,....]]
<Application.Resources>
<SolidColorBrush x:Key="GreenLight" Color="#0CAF12" />
</Application.Resources>
<Setter Property="Label.Content" Value="Connected" />
<DataTrigger.EnterActions>
<BeginStoryboard Name="StoryConnected">
<Storyboard Storyboard.TargetProperty="(Background).(SolidColorBrush.Color)">
<ColorAnimation Storyboard.TargetProperty="(Background).(SolidColorBrush.Color)" To="{StaticResource GreenLight}" Duration="0:0:0.5" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<RemoveStoryboard BeginStoryboardName="StoryConnected" />
</DataTrigger.ExitActions>