I'm changing the TextBlock
color through the trigger, after 5 seconds, I would like to switch the color back to the TextBlock
's initial, default color that is defined in the resource dictionary, without defining the color explicitly.
Here is the TextBlock
style I use:
<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>
I mean this line specifically:
<ColorAnimation
BeginTime="0:0:05"
Storyboard.TargetProperty="Foreground.Color"
To="???" />
I have tried setting To
property to {x:Null}
markup extension, however the color remains the same.
How can I make it animate to the default color?
edit
Since @Rekshino marked this question as a possible duplicate, I want to state that there is no relation between my question and the question linked by him, hence question might have been misunderstood by him as I haven't asked about To
property bindings.