• 【万里征程——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柯于旺 原创文章,如需转载请联系本人。

  • 相关阅读:
    Linux命令行操作基础练习
    Linux基础系统优化
    神奇的二维码(觉得有点儿意思,转了~)
    django 中的cookie和session
    django 中间件操作
    django orm操作
    django 视图
    django 路由
    django(2) 模板
    django 模板(1)
  • 原文地址:https://www.cnblogs.com/NoMasp/p/4786041.html
Copyright © 2020-2023  润新知