【问题标题】:stretch grid child element storyboard scale wp8拉伸网格子元素故事板规模 wp8
【发布时间】:2014-09-18 18:38:04
【问题描述】:

故事板动画后拉伸子网格元素。如何停止拉伸 Grid 子元素 这是故事板代码

  <Storyboard x:Name="Storyboard_FullScreenSensor">
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)" Storyboard.TargetName="GridM">
            <EasingDoubleKeyFrame KeyTime="0" Value="1.088"/>
            <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1.417"/>
        </DoubleAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="GridM">
            <EasingDoubleKeyFrame KeyTime="0" Value="-3"/>
            <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="-15"/>
        </DoubleAnimationUsingKeyFrames>
    </Storyboard>

和 GridM 代码,其中包含许多视图项,例如按钮、图片

 <Grid 
        x:Name="GridM" 
        Height="340" Margin="0,85,0,0"
  RenderTransformOrigin="0.5,0.5">
        <Grid.RenderTransform>
            <CompositeTransform/>
        </Grid.RenderTransform>

        <Grid 
        Name="GridLoader"
        >
// code
        </Grid>

        <ContentControl 
            x:Name="" 
            >
            //code

        </ContentControl>

        <Grid
            Name="GridChild"
/>
</Grid>

故事板动画后拉伸媒体网格中的所有孩子 显示为

所需的视图是

【问题讨论】:

    标签: windows-phone-8 storyboard


    【解决方案1】:

    如果使用Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)",则在故事板中拉伸该网格。使用

    解决
     <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Width)" Storyboard.TargetName="GridM">
                <EasingDoubleKeyFrame KeyTime="0" Value="480"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="800"/>
            </DoubleAnimationUsingKeyFrames>
    

     <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Height)" Storyboard.TargetName="GridM">
                <EasingDoubleKeyFrame KeyTime="0" Value="340"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="480"/>
            </DoubleAnimationUsingKeyFrames>
    

    它在启动storyboard.Begin()时为特定组件的宽度或高度设置动画

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-05-21
      • 2022-09-27
      • 1970-01-01
      • 2014-08-18
      • 2012-07-30
      • 1970-01-01
      • 2011-09-06
      相关资源
      最近更新 更多