【万里征程——Windows App开发】动画1

这个效果比较简单,就是在启动时,控件会稍微有那么一点点的滑动效果。

<UserControl.Resources>
     <Style x:Key="EntranceButtonStyle" TargetType="Button">
         <Setter Property="Transitions">
             <Setter.Value>
                 <TransitionCollection>
                     <EntranceThemeTransition/>
                 </TransitionCollection>
             </Setter.Value>
        </Setter>
    </Style>
</UserControl.Resources>

  <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <Button Style="{StaticResource EntranceButtonStyle}" Content="滑动样式"/>
</Grid>

既然主题是动画,那么不来点动画怎么行呢?不过由于GIF截图不太方便,而且也非常推荐大家自己试一下。

  <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
          <ItemsControl Grid.Row="1" x:Name="itemsControlRectangle">             
            <ItemsControl.ItemContainerTransitions>
                <TransitionCollection>
                    <EntranceThemeTransition/>
                </TransitionCollection>
            </ItemsControl.ItemContainerTransitions>
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapGrid Height="400"/>
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>

            <ItemsControl.Items>
                <Rectangle Fill="Red" Width="100" Height="100" Margin="12"/>
                <Rectangle Fill="Wheat" Width="100" Height="100" Margin="12"/>
                <Rectangle Fill="Yellow" Width="100" Height="100" Margin="12"/>
                <Rectangle Fill="Blue" Width="100" Height="100" Margin="12"/>
                <Rectangle Fill="Green" Width="100" Height="100" Margin="12"/>
                <Rectangle Fill="Gray" Width="100" Height="100" Margin="12"/>
                <Rectangle Fill="White" Width="100" Height="100" Margin="12"/>
                <Rectangle Fill="Gainsboro" Width="100" Height="100" Margin="12"/>
                <Rectangle Fill="Magenta" Width="100" Height="100" Margin="12"/>
                <Rectangle Fill="CadetBlue" Width="100" Height="100" Margin="12"/>
                <Rectangle Fill="NavajoWhite" Width="100" Height="100" Margin="12"/>
                <Rectangle Fill="Khaki" Width="100" Height="100" Margin="12"/>
            </ItemsControl.Items>
        </ItemsControl>
    </Grid>

因为这些Rectangle都是在ItemsControl中的,因为在容器控件中应用主题样式时,其所有的子对象也都会继承下来。



为使本文得到斧正和提问,转载请注明出处:
http://blog.csdn.net/nomasp

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值