Reputation: 16705
I have a number of animations that I would like to execute on the Loaded event of a control:
<EventTrigger RoutedEvent="Button.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation ...
<DoubleAnimation ...
<DoubleAnimation ...
What I would like to do is execute the first two in parallel (which seems to be the default behaviour), and the last once they have finished. Is this possible and, if so, how?
Upvotes: 1
Views: 291
Reputation: 102793
The Blend "interactivity" DLLs support this scenario. Set a StoryboardCompletedTrigger on the first storyboard, with a ControlStoryboardAction on the second. For example (note that this requires references to System.Windows.Interactivity.dll and Microsoft.Expression.Interactions.dll):
<Grid x:Name="LayoutRoot"
xmlns:em="clr-namespace:Microsoft.Expression.Interactivity.Media;assembly=Microsoft.Expression.Interactions"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
>
<Grid.Resources>
<Storyboard x:Name="FirstStoryboard">
<DoubleAnimation ...
<DoubleAnimation ...
</Storyboard>
<Storyboard x:Name="SecondStoryboard">
<DoubleAnimation ...
</Storyboard>
</Grid.Resources>
<i:Interaction.Triggers>
<i:EventTrigger EventName="Loaded">
<em:ControlStoryboardAction Storyboard="{StaticResource FirstStoryboard}" />
</i:EventTrigger>
<em:StoryboardCompletedTrigger Storyboard="{StaticResource FirstStoryboard}">
<em:ControlStoryboardAction Storyboard="{StaticResource SecondStoryboard}" />
</em:StoryboardCompletedTrigger>
</i:Interaction.Triggers>
</Grid>
Upvotes: 1