EntranceThemeTransition 不适用于 UWP? [英] EntranceThemeTransition not working on UWP?

查看:32
本文介绍了EntranceThemeTransition 不适用于 UWP?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

转换是否适用于通用 Windows 平台 (UWP)/Windows 10 的应用程序?

Do the transitions work in apps for the Universal Windows Plattform (UWP) / Windows 10?

我将以下代码粘贴到一个空白页面中,但动画不起作用.

I pasted the following code into an empty page, but the animation wouldn't work.

<ItemsControl Grid.Row="1" x:Name="rectangleItems">
    <ItemsControl.ItemContainerTransitions>
        <TransitionCollection>
            <EntranceThemeTransition/>
        </TransitionCollection>
    </ItemsControl.ItemContainerTransitions>
    <ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>
            <WrapGrid Height="400"/>
        </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>

    <!-- The sequence children appear depends on their order in 
     the panel's children, not necessarily on where they render
     on the screen. Be sure to arrange your child elements in
     the order you want them to transition into view. -->
    <ItemsControl.Items>
        <Rectangle Fill="Red" Width="100" Height="100" Margin="10"/>
        <Rectangle Fill="Red" Width="100" Height="100" Margin="10"/>
        <Rectangle Fill="Red" Width="100" Height="100" Margin="10"/>
        <Rectangle Fill="Red" Width="100" Height="100" Margin="10"/>
        <Rectangle Fill="Red" Width="100" Height="100" Margin="10"/>
        <Rectangle Fill="Red" Width="100" Height="100" Margin="10"/>
        <Rectangle Fill="Red" Width="100" Height="100" Margin="10"/>
        <Rectangle Fill="Red" Width="100" Height="100" Margin="10"/>
        <Rectangle Fill="Red" Width="100" Height="100" Margin="10"/>
    </ItemsControl.Items>
</ItemsControl>

推荐答案

EntranceThemeTransition 适用于 UWP.您可以将 IsStaggeringEnabled 设置为 true 并获得动画,即使项目已经存在(您的情况).

EntranceThemeTransition works on UWP. You can set IsStaggeringEnabled to true and get the animation even if the items are already there (your case).

<ItemsControl.ItemContainerTransitions>
    <TransitionCollection>
        <EntranceThemeTransition IsStaggeringEnabled="True"/>
    </TransitionCollection>
</ItemsControl.ItemContainerTransitions>

这篇关于EntranceThemeTransition 不适用于 UWP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆