I have this XAML:
<Style.Triggers>
<DataTrigger Binding="..." Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard Name="ToTrue">
...
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<BeginStoryboard Name="ToFalse">
...
</BeginStoryboard>
</DataTrigger.ExitActions>
</DataTrigger>
<EventTrigger RoutedEvent="Loaded">
<SkipStoryboardToFill BeginStoryboardName="ToTrue"/>
<SkipStoryboardToFill BeginStoryboardName="ToFalse"/>
</EventTrigger>
</Style.Triggers>
As you can see, I am using SkipStoryboardToFill
to ensure that when the control first loads it doesn't bother playing the transition storyboards.
This works. However, it spams the console with warnings (since only one of the storyboards will be active) and isn't elegant at all.
Is there a "correct" way of skipping all active storyboards on an element that I'm not seeing?
There is no code-behind to work with here.