我正在通过触发器更改TextBlock
的颜色,在5秒钟后,我想将颜色切换回资源字典中定义的TextBlock
的初始默认颜色,而无需明确定义颜色。
这是我使用的TextBlock
样式:
<Style BasedOn="{StaticResource {x:Type TextBlock}}" TargetType="{x:Type TextBlock}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsSelected}" Value="True">
<Setter Property="Foreground" Value="{StaticResource LightBackgroundBrush}" />
<!-- Go back to initial color -->
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation
BeginTime="0:0:05"
Storyboard.TargetProperty="Foreground.Color"
To="???" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
</DataTrigger>
</Style.Triggers>
</Style>
我的意思是这行:
<ColorAnimation
BeginTime="0:0:05"
Storyboard.TargetProperty="Foreground.Color"
To="???" />
我尝试将To
属性设置为{x:Null}
标记扩展,但是颜色保持不变。
如何使其设置为默认颜色的动画?
由于@Rekshino将此问题标记为可能重复,因此我想声明我的问题与他所链接的问题之间没有关系,因此,由于我没有问过{{ 1}}属性绑定。