ListView for Xamarin.iOS: Animations
TKListView supports the following predefined animations:
The animated images above are just for illustration purposes. They are missing some fps quality because of the image processing software used to create these images. In order to get a real understanding of how the animations look and feel, check the Demo application that ships with the UI for Xamarin suite.
These animations can be applied when items enter different states. The following list contains all states where animations can be applied:
- when an item appears when scrolling
- when adding/inserting an item
- when removing an item
Accessing the Animations API
The animations can be controlled from the animations-related properties of the Telerik ListView layouts. These properties are exposed at the TKListViewLinearLayout which is the base layout for the TKListViewGridLayout and TKListViewStaggeredLayout. So, in order to apply some animation settings to that layout, you can take it like this:
TKListViewLinearLayout layout = (TKListViewLinearLayout)listView.Layout;
Those animations are applied when scrolling the list view. You can add a scroll animation by setting the
ItemAppearAnimation property of
layout.ItemAppearAnimation = TKListViewItemAnimation.Scale;
To animate an item on insert set the
layout.ItemInsertAnimation = TKListViewItemAnimation.Scale;
To animate an item on delete set the
layout.ItemDeleteAnimation = TKListViewItemAnimation.Slide;
Be sure to update your data source before triggering item insert/delete methods in TKListView.
Animations are controlled by setting properties of
TKListViewLinearLayout class. The animation duration is controlled by setting the
layout.AnimationDuration = 0.4f;
A sample ListView Animations example can be found in our Native Xamarin.iOS examples.