2013-06-24 37 views
1

我想實現這樣的效果:
有一個80 * 80滾動視圖,我把一個160 * 80 PIC它
1S:PIC的左/在向上滾動視圖,2S:PIC的右/上在滾動視圖
滾動作爲過渡過程動畫無法在滾動視圖開始的Windows Phone

我的代碼:
XAML

<UserControl.Resources> 
    <Storyboard x:Name="Storyboard1"> 
     <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="my_combo_pic"> 
      <EasingDoubleKeyFrame KeyTime="0" Value="0"/> 
      <EasingDoubleKeyFrame KeyTime="0:0:3" Value="80"/> 
     </DoubleAnimationUsingKeyFrames> 
     <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="my_combo_pic"> 
      <EasingDoubleKeyFrame KeyTime="0" Value="0"/> 
      <EasingDoubleKeyFrame KeyTime="0:0:3" Value="0"/> 
     </DoubleAnimationUsingKeyFrames> 
    </Storyboard> 
</UserControl.Resources> 


... 
       <ScrollViewer x:Name="my_combo" Tap="MyCombolIconTapped" HorizontalAlignment="Right" Height="80" Margin="0" VerticalAlignment="Bottom" Width="80"> 
        <Image x:Name="my_combo_pic" Stretch="Fill" Source="/Images/my_combo_icon.png" RenderTransformOrigin="0.5,0.5" Height="160" Width="80"> 
         <Image.RenderTransform> 
          <CompositeTransform/> 
         </Image.RenderTransform> 
        </Image> 
       </ScrollViewer> 
      </Grid> 

CS

Storyboard1.Begin(); 
在加載

但是,我發現,動畫不工作,即使它運作良好,在Expression Blend中
所以

,u能幫助我找到了它是什麼原因?
或者給我另一種方式來實現這個
謝謝你!
任何意見將是巨大的

回答

1

放置一個Grid在您ScrollViewer內容如下所示:

<ScrollViewer> 
     <Grid> 
      <Image x:Name="my_combo_pic" Stretch="Fill" Source="/Images/my_combo_icon.png" RenderTransformOrigin="0.5,0.5" Height="160" Width="266"> 
       <Image.RenderTransform> 
        <CompositeTransform /> 
       </Image.RenderTransform> 
      </Image> 
     </Grid> 
</ScrollViewer> 

這裏的問題是,動畫系統越來越有點困惑,因爲ScrollViewer只有在它有一個Image這本身並不是一個容器,所以它認爲沒有什麼地方可以進行動畫製作(因爲它與任何東西都沒有關係)。

+0

但有一個問題,如果我將scrollview更改爲網格,滾動對象將位於容器上方,並且我會看到容器上方的整個160 * 80滾動對象。 – iloveiniestaandowen

+0

我只是想讓容器中的滾動對象,而我只看到80 * 80 – iloveiniestaandowen

+0

最讓我困惑的是,當我使用移動位置動畫時,移動對象似乎總是在表面上,在所有容器之上,我不知道我的錯在哪裏 – iloveiniestaandowen