为什么不能在scrollview中直接添加一个image,然后使animation.begin()??

http://stackoverflow.com/questions/17267451/animation-cant-begin-in-scrollview-in-windows-phone

以上是我在SO中提的一个问题

我简单贴下代码,问题描述在上述网址中

<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>

最终动画在wp device上没有运作

虽然在blend中表现良好!

原因是:

http://msdn.microsoft.com/zh-cn/library/windowsphone/develop/jj206955%28v=vs.105%29.aspx

2. 创建情节提要并将其变成资源

Storyboard 是您存放动画对象的容器。您必须将 Storyboard 变成可用于要进行动画处理的对象的资源。下面的 XAML 演示如何将 Storyboard 变成根元素的资源(一个 StackPanel)。

XAML
<StackPanel x:Name="rootElement">
    <StackPanel.Resources>
    <!-- Animates the rectangle's opacity. -->
        <Storyboard x:Name="myStoryboard">
            <!-- Animation objects go here. -->
        </Storyboard>
    </StackPanel.Resources>
</StackPanel>

转载于:https://www.cnblogs.com/fifa0329/p/4536671.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值