2011-12-07 15 views
1

マーケットアプリケーションでアプリをクリックすると発生する 'Down and Away'スタイルを模倣して作成しているListBoxItemスタイルがあります。ListBoxItemを選択してアニメーションを終了する前に終了

私はSelectionChangedイベントを処理していない場合、それは(完全一致していませんが、ちょっと:p)はOK作品私はSelectionChanged扱う際にアニメーションが完了する前に、しかし、ページだけで瞬時に移動します。

理想的には、私は、一般的なページに移動する前に、完全なアニメーションをさせる処理する方法を学ぶことに興味があると思います。私はおそらく待つようにDispatcherTimerを使用することができます理解しますが、私のような何かを行うことを好むだろう:私はあなたがツールキットに含まれていない連続アニメーション、について話していると思う

if (selected item has storyboard, and storyboard is going) 
    when finished, navigate to page2. 


<Style x:Key="StretchedListBoxStyle" TargetType="ListBoxItem"> 

     <Setter Property="Background" Value="Transparent" /> 
     <Setter Property="BorderThickness" Value="0" /> 
     <Setter Property="BorderBrush" Value="Transparent" /> 
     <Setter Property="Padding" Value="0" /> 
     <Setter Property="HorizontalContentAlignment" Value="Stretch" /> 
     <Setter Property="VerticalContentAlignment" Value="Top" /> 
     <Setter Property="Template"> 
      <Setter.Value> 
       <ControlTemplate TargetType="ListBoxItem"> 
        <Border x:Name="LayoutRoot" 
          HorizontalAlignment="{TemplateBinding HorizontalAlignment}" 
          VerticalAlignment="{TemplateBinding VerticalAlignment}" 
          Background="{TemplateBinding Background}" 
          BorderBrush="{TemplateBinding BorderBrush}" 
          BorderThickness="{TemplateBinding BorderThickness}"> 
         <VisualStateManager.VisualStateGroups> 
          <VisualStateGroup x:Name="CommonStates"> 
           <VisualState x:Name="Normal" /> 
           <VisualState x:Name="MouseOver" /> 
           <VisualState x:Name="Disabled"> 
            <Storyboard> 
             <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="Background"> 
              <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TransparentBrush}" /> 
             </ObjectAnimationUsingKeyFrames> 
             <DoubleAnimation Duration="0" 
                 Storyboard.TargetName="ContentContainer" 
                 Storyboard.TargetProperty="Opacity" 
                 To=".5" /> 
            </Storyboard> 
           </VisualState> 
          </VisualStateGroup> 
          <VisualStateGroup x:Name="SelectionStates"> 
           <VisualState x:Name="Unselected" /> 
           <VisualState x:Name="Selected"> 
            <Storyboard> 
             <DoubleAnimationUsingKeyFrames Storyboard.TargetName="ContentContainer" Storyboard.TargetProperty="(UIElement.Opacity)"> 
              <SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="1" /> 
             </DoubleAnimationUsingKeyFrames> 
             <DoubleAnimationUsingKeyFrames Storyboard.TargetName="ContentContainer" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)"> 
              <EasingDoubleKeyFrame KeyTime="0" Value="0" /> 
              <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="900" /> 
             </DoubleAnimationUsingKeyFrames> 
             <DoubleAnimationUsingKeyFrames Storyboard.TargetName="ContentContainer" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)"> 
              <EasingDoubleKeyFrame KeyTime="0" Value="0" /> 
              <EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="30" /> 
             </DoubleAnimationUsingKeyFrames> 
            </Storyboard> 
           </VisualState> 
          </VisualStateGroup> 
         </VisualStateManager.VisualStateGroups> 
         <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"> 
          <ContentControl.RenderTransform> 
           <CompositeTransform /> 
          </ContentControl.RenderTransform> 
          <ContentControl.Projection> 
           <PlaneProjection /> 
          </ContentControl.Projection> 
         </ContentControl> 
        </Border> 
       </ControlTemplate> 
      </Setter.Value> 
     </Setter> 
    </Style> 

答えて

1

を。このアニメーションはListBoxItemスタイル内で起こるべきではありません。

私はしばらく前にthis questionを尋ね、私は1つがあなたが達成したい何を与えることができますどちらかと信じています。 :)

+0

は素晴らしい、病気のことをチェックしてください。ありがとう! –

関連する問題