zoukankan      html  css  js  c++  java
  • 【万里征程——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

    版权声明:本文为 NoMasp柯于旺 原创文章,如需转载请联系本人。

  • 相关阅读:
    分享PHP获取客户端IP的几种不同方式
    php魔术方法get和set举例
    PHP正确匹配图片路径
    PHP通用的防注入过滤用户字符串函数
    用PHP逐行读取TXT文件
    atitit.ajax 最佳实践跟框架选型 o99
    Atitit.研发管理提升效率软件开发方法DSM总结o99
    Atitit. js mvc 总结(2)angular 跟 Knockout o99 最佳实践
    atitit.hbnt orm db 新新增更新最佳实践o99
    Atitit.提升稳定性分析内存泄漏PermGen OOM跟解决之道...java
  • 原文地址:https://www.cnblogs.com/NoMasp/p/4786041.html
Copyright © 2011-2022 走看看