title: Making ListBoxItem Selected Animation finish before Navigating
body: <p>I have a <code>ListBoxItem</code> style which I'm creating to mimic the 'Down and Away' style which happens when you click on a app in the marketplace app.</p>
  
  <p>If I don't handle the <code>SelectionChanged</code> event, it works OK(doesn't match perfect, but hey :p), however when I handle <code>SelectionChanged</code>, the page just instantly navigates before the animation completes. </p>
  
  <p>Ideally, I'd be interested in learning how to handle letting an animation complete before navigating to a generic page. I understand I could probably use a <code>DispatcherTimer</code> to wait, but I'd prefer to do something like:</p>
  
  <pre><code>if (selected item has storyboard, and storyboard is going)
     when finished, navigate to page2.
  
  
  &lt;Style x:Key="StretchedListBoxStyle" TargetType="ListBoxItem"&gt;
  
          &lt;Setter Property="Background" Value="Transparent" /&gt;
          &lt;Setter Property="BorderThickness" Value="0" /&gt;
          &lt;Setter Property="BorderBrush" Value="Transparent" /&gt;
          &lt;Setter Property="Padding" Value="0" /&gt;
          &lt;Setter Property="HorizontalContentAlignment" Value="Stretch" /&gt;
          &lt;Setter Property="VerticalContentAlignment" Value="Top" /&gt;
          &lt;Setter Property="Template"&gt;
              &lt;Setter.Value&gt;
                  &lt;ControlTemplate TargetType="ListBoxItem"&gt;
                      &lt;Border x:Name="LayoutRoot"
                              HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                              VerticalAlignment="{TemplateBinding VerticalAlignment}"
                              Background="{TemplateBinding Background}"
                              BorderBrush="{TemplateBinding BorderBrush}"
                              BorderThickness="{TemplateBinding BorderThickness}"&gt;
                          &lt;VisualStateManager.VisualStateGroups&gt;
                              &lt;VisualStateGroup x:Name="CommonStates"&gt;
                                  &lt;VisualState x:Name="Normal" /&gt;
                                  &lt;VisualState x:Name="MouseOver" /&gt;
                                  &lt;VisualState x:Name="Disabled"&gt;
                                      &lt;Storyboard&gt;
                                          &lt;ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="Background"&gt;
                                              &lt;DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TransparentBrush}" /&gt;
                                          &lt;/ObjectAnimationUsingKeyFrames&gt;
                                          &lt;DoubleAnimation Duration="0"
                                                           Storyboard.TargetName="ContentContainer"
                                                           Storyboard.TargetProperty="Opacity"
                                                           To=".5" /&gt;
                                      &lt;/Storyboard&gt;
                                  &lt;/VisualState&gt;
                              &lt;/VisualStateGroup&gt;
                              &lt;VisualStateGroup x:Name="SelectionStates"&gt;
                                  &lt;VisualState x:Name="Unselected" /&gt;
                                  &lt;VisualState x:Name="Selected"&gt;
                                      &lt;Storyboard&gt;
                                          &lt;DoubleAnimationUsingKeyFrames Storyboard.TargetName="ContentContainer" Storyboard.TargetProperty="(UIElement.Opacity)"&gt;
                                              &lt;SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="1" /&gt;
                                          &lt;/DoubleAnimationUsingKeyFrames&gt;
                                          &lt;DoubleAnimationUsingKeyFrames Storyboard.TargetName="ContentContainer" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)"&gt;
                                              &lt;EasingDoubleKeyFrame KeyTime="0" Value="0" /&gt;
                                              &lt;EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="900" /&gt;
                                          &lt;/DoubleAnimationUsingKeyFrames&gt;
                                          &lt;DoubleAnimationUsingKeyFrames Storyboard.TargetName="ContentContainer" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)"&gt;
                                              &lt;EasingDoubleKeyFrame KeyTime="0" Value="0" /&gt;
                                              &lt;EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="30" /&gt;
                                          &lt;/DoubleAnimationUsingKeyFrames&gt;
                                      &lt;/Storyboard&gt;
                                  &lt;/VisualState&gt;
                              &lt;/VisualStateGroup&gt;
                          &lt;/VisualStateManager.VisualStateGroups&gt;
                          &lt;ContentControl x:Name="ContentContainer"
                                          Margin="{TemplateBinding Padding}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                          HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          Content="{TemplateBinding Content}"
                                          ContentTemplate="{TemplateBinding ContentTemplate}"
                                          Foreground="{TemplateBinding Foreground}"
                                          RenderTransformOrigin="0.5,0.5"&gt;
                              &lt;ContentControl.RenderTransform&gt;
                                  &lt;CompositeTransform /&gt;
                              &lt;/ContentControl.RenderTransform&gt;
                              &lt;ContentControl.Projection&gt;
                                  &lt;PlaneProjection /&gt;
                              &lt;/ContentControl.Projection&gt;
                          &lt;/ContentControl&gt;
                      &lt;/Border&gt;
                  &lt;/ControlTemplate&gt;
              &lt;/Setter.Value&gt;
          &lt;/Setter&gt;
      &lt;/Style&gt;
  </code></pre>