zoukankan      html  css  js  c++  java
  • 为什么不能在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)。

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

  • 相关阅读:
    装配Bean
    百练
    东软小选拔
    俄罗斯乘法
    POJ
    ACdream
    javascript 链式作用域
    ie6/7 bug
    onreadystatechange 和 status
    瀑布流 <<转>>
  • 原文地址:https://www.cnblogs.com/fifa0329/p/4536671.html
Copyright © 2011-2022 走看看