maui-devexpress-dot-maui-dot-collectionview-dot-dxcollectionview.md
Occurs when a user taps and holds an item within the collection view.
Namespace : DevExpress.Maui.CollectionView
Assembly : DevExpress.Maui.CollectionView.dll
NuGet Package : DevExpress.Maui.CollectionView
public event EventHandler<CollectionViewGestureEventArgs> LongPress
The LongPress event's data class is CollectionViewGestureEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| Item | Gets an object that specifies a data source’s item to which the CollectionView’s data row corresponds. |
| ItemHandle | Gets the handle of the processed item. Inherited from ItemEventArgs. |
You can use two methods to identify the tapped item. The event argument’s Item property returns the item’s corresponding data source object. To receive the item’s handle, use the ItemHandle property.
The following example deletes an item from the collection view and its bound data source when a user taps and holds the item:
<dxcv:DXCollectionView x:Name="collectionView"
LongPress="CollectionView_OnLongPress" >
</dxcv:DXCollectionView>
void CollectionView_OnLongPress(object sender, CollectionViewGestureEventArgs e) {
collectionView.DeleteItem(e.ItemHandle);
}
Review our GitHub repo for more examples:
View Example: Enable Multiple Selection and Implement the Contextual Action Bar
See Also