Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I NOT animate a list view in XAML?

This applies to UWP, how can I disable animation of list view items? I have a method that runs every few seconds, and the fly-in animation effect makes it visually displeasing. I want to disable the effect. Not much code to share, but here's my ListView:

<ListView RelativePanel.Below="pageHeader" ItemsSource="{Binding DataItems}" />
like image 412
haosmark Avatar asked Apr 19 '17 01:04

haosmark


People also ask

How to define list items in listview in XAML?

The ListView class doesn't support defining list items in XAML, you must use the ItemsSource property or data binding with an ItemTemplate to define items in the list. A ListView is best suited for a collections consisting of a single data type.

What is listbox in XAML?

XAML - ListBox. A ListBox is a control that provides a list of items to the user item selection. The user can select one or more items from a predefined list of items at a time.

How do I populate listview with items?

ListView is an ItemsControl, so it can contain a collection of items of any type. To populate the view, add items to the Items collection, or set the ItemsSource property to a data source.

How do I display a list of items in a GridView?

To display a collection in rows and columns, use a GridView. ListView is an ItemsControl, so it can contain a collection of items of any type. To populate the view, add items to the Items collection, or set the ItemsSource property to a data source.


2 Answers

You have to disable the transitions:

<ListView Transitions="{x:Null}"
          ItemContainerTransitions="{x:Null}">
</ListView>
like image 119
Laith Avatar answered Sep 28 '22 20:09

Laith


If you want to set the scroll position, try this:

this.ListView.ScrollIntoView(ListView.SelectedItem);
like image 44
Ann Yu Avatar answered Sep 28 '22 18:09

Ann Yu