n179911
n179911

Reputation: 20301

How to disable animation when adding items to list view

How can I disable the animation when adding a new item to list view?

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

I tried this example, but it does not show any list footer for my list.

I have tried doing this:

    <ListView>
        <ListView.ItemContainerTransitions>
            <ContentThemeTransition />  <!-- omit AddDeleteThemeTransition -->

        </ListView.ItemContainerTransitions>
    </ListView>

But that does not run, it crashes when I start the app.

Upvotes: 3

Views: 625

Answers (1)

Decade Moon
Decade Moon

Reputation: 34286

There is this quirk as noted in the documentation for ItemsControl.ItemContainerTransitions property:

Important The XAML syntax for properties that have a TransitionCollection value is unusual in that you must declare an explicit TransitionCollection object element as the value, and then provide object elements as child elements of TransitionCollection for each of the transition animations you want to use. For most other XAML collection properties you could omit the collection object element because it can be implicit, but TransitionCollection doesn't support the implicit collection usage.

Try this XAML instead:

<ListView>
    <ListView.ItemContainerTransitions>
        <TransitionCollection>
            <ContentThemeTransition />  <!-- You can even omit this transition if desired -->
        </TransitionCollection>
    </ListView.ItemContainerTransitions>
</ListView>

Upvotes: 2

Related Questions