Pra*_*thi 1 c# wpf xaml windows-phone-8
我需要创建一个启动画面,其中图像需要从屏幕底部向上滑动.最初它应该放在视口外面然后引入.我明白我需要使用故事板动画,给目标属性作为图像的名称和使用渲染translate.Since是XAML的新手.我有裸露的骨架,我不知道如何从这里构建东西..请帮忙.
<Grid HorizontalAlignment="Left" Height="1047" VerticalAlignment="Top" Width="480" Margin="0,-24,0,-255" Background="White">
<Grid.Resources>
<Storyboard x:Name="myanimation">
<DoubleAnimation></DoubleAnimation>
</Storyboard>
</Grid.Resources>
<Image HorizontalAlignment="Left" Height="252" Margin="0,795,0,0" VerticalAlignment="Top" Width="480" Source="/Assets/splash-bottom.png"/>
</Grid>
Run Code Online (Sandbox Code Playgroud)
最简单的方法是向图像添加CompositeTransform,最初设置屏幕,然后为TranslateY属性设置动画.
<Grid ...>
<Grid.Resources>
<Storyboard x:Name="MainImageSlideIn">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="MainImage">
<EasingDoubleKeyFrame KeyTime="0" Value="900"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</Grid.Resources>
<Image x:Name="MainImage"HorizontalAlignment="Left" VerticalAlignment="Top" Width="480" Source="/Assets/splash-bottom.png">
<Image.RenderTransform>
<CompositeTransform TranslateY="900" />
</Image.RenderTransform>
</Image>
</Grid>
Run Code Online (Sandbox Code Playgroud)
您还需要触发故事板才能开始.我不记得XAML是否将其作为事件触发,但您可以Loaded
在C#中的页面事件中添加MainImageSlideIn.Begin()