EntranceThemeTransition not working on UWP?

旧时模样 提交于 2019-12-12 06:27:40

问题


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>

回答1:


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>


来源:https://stackoverflow.com/questions/33518493/entrancethemetransition-not-working-on-uwp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!