How to set animations/transitions when adding elements to a ListViews?

后端 未结 1 883
孤街浪徒
孤街浪徒 2021-01-19 02:01

I have got a ListView wich I added Elements by binding. The ListView looks like:

 

        
相关标签:
1条回答
  • 2021-01-19 02:47

    This should work:

    <ListView
        x:Name="lv">
        <ListView.ItemsPanel>
            <ItemsPanelTemplate>
                <VirtualizingStackPanel>
                    <VirtualizingStackPanel.ChildrenTransitions>
                        <TransitionCollection>
                            <EntranceThemeTransition
                                FromHorizontalOffset="400" />
                        </TransitionCollection>
                    </VirtualizingStackPanel.ChildrenTransitions>
                </VirtualizingStackPanel>
            </ItemsPanelTemplate>
        </ListView.ItemsPanel>
    </ListView>
    

    *Update:

    You can also use ListView.ItemContainerTransitions to define these transitions.

    0 讨论(0)
提交回复
热议问题