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柯于旺 原创文章,如需转载请联系本人。

  • 相关阅读:
    Python并发编程之深入理解yield from语法(八)
    Python并发编程之从生成器使用入门协程(七)
    Python并发编程之消息队列补充及如何创建线程池(六)
    Delphi中Chrome Chromium、Cef3学习笔记(一)
    Webbrowser指定IE内核版本(更改注册表)
    C#截取字符串按字节截取SubString
    C# DataGridView导出Excel
    C# Microsoft.Office不存在空间名称Interop和Excel
    c#线程间传递参数
    C#根据进程名称获取进程的句柄?
  • 原文地址:https://www.cnblogs.com/NoMasp/p/4786041.html
Copyright © 2011-2022 走看看