Skip to main content

DXCollectionView.TapConfirmed Event

Occurs when a single tap is confirmed (the wait for the second tap in a double-tap gesture timed out).

Namespace: DevExpress.Maui.CollectionView

Assembly: DevExpress.Maui.CollectionView.dll

NuGet Package: DevExpress.Maui.CollectionView

Declaration

public event EventHandler<CollectionViewGestureEventArgs> TapConfirmed

Event Data

The TapConfirmed 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.

Remarks

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.

If the control allows item selection (SelectionMode is set to Single or Multiple), the SelectionChanged event also occurs after a user taps a Collection View item.

The DXCollectionView raises the events in the following order for taps with selection enabled:

As an alternative to the TapConfirmed event, TapConfirmedCommand to respond taps within the Collection View.

Example

The following example shows a message when a user taps a collection view item:

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:dxcv="clr-namespace:DevExpress.Maui.CollectionView;assembly=DevExpress.Maui.CollectionView"
             xmlns:local="clr-namespace:CollectionViewExample"
             x:Class="CollectionViewExample.MainPage"
             BackgroundColor="{DynamicResource PageBackgroundColor}">
    <ContentPage.BindingContext>
        <local:ViewModel/>
    </ContentPage.BindingContext>
    <dxcv:DXCollectionView x:Name="collectionView"
                           ItemsSource="{Binding Data}" 
                           DisplayMember="Name"
                           TapConfirmed="DXCollectionView_Tap" >
        <!--...-->
    </dxcv:DXCollectionView>

</ContentPage>
using Microsoft.Maui.Controls;

namespace CollectionViewExample {
    public partial class MainPage : ContentPage {
        public MainPage() {
            InitializeComponent();
        }
        private void DXCollectionView_Tap(object sender, DevExpress.Maui.CollectionView.CollectionViewGestureEventArgs e) {
            Contact contact = e.Item as Contact;
            string customerName = contact.Name;
            string customerPhone = contact.Phone;
            Application.Current.MainPage.DisplayAlert("Contact Info", "Name: " + customerName + "\n" + "Phone: " + customerPhone, "OK");
        }
    }
}
See Also