maui-403333-collection-view-swipe.md
You can extend CollectionView’s UI with additional elements that appear when a user swipes an item from left to right or from right to left and perform custom actions on tap. For the Horizontal orientation, the CollectionView supports top-to-bottom and bottom-to-top swipe gestures for items.
View Example: CollectionView - Swipe Actions
To implement this functionality, set the DXCollectionView.ItemTemplate property to a data template that contains a SwipeContainer object and specify this container’s properties as follows:
Assign a View class descendant to the ItemView property to define the appearance of CollectionView items.
Populate StartSwipeItems and EndSwipeItems collections with swipe items. A swipe item is a visual element that appears on the left or right side of a data item when a user swipes the item, and performs a custom action on tap. If the CollectionView is horizontally oriented, it displays swipe items on the top or bottom of data items. You can use the Size property to specify a swipe item’s width (for vertical orientation of the collection view) or height (for horizontal orientation). Swipe items can be of the following types:
Use the FullSwipeMode property to specify whether the CollectionView should perform the first action from the StartSwipeItems collection and the last action from EndSwipeItems in response to a full swipe across a data item.
If you want to show or hide swipe items by a specified condition, handle the SwipeItemShowing event.
This example shows how to define the following two swipe actions for items of the vertical CollectionView bound to the list of tasks:
Create the ViewModel class with the Data property that returns a collection of tasks. This collection is a data source for the CollectionView.
Set the ContentPage’s BindingContext to a ViewModel object.
Add a DXCollectionView object to the page and bind its ItemsSource property to the view model’s Data property.
Define a template for CollectionView items:
Specify swipe actions: