Back to Devexpress

DataGridView.DoubleTap Event

mobilecontrols-devexpress-dot-xamarinforms-dot-datagrid-dot-datagridview-975e64e7.md

latest5.0 KB
Original Source

DataGridView.DoubleTap Event

Occurs when a user double taps the grid.

Namespace : DevExpress.XamarinForms.DataGrid

Assembly : DevExpress.XamarinForms.Grid.dll

NuGet Package : DevExpress.XamarinForms.Grid

Declaration

csharp
public event DataGridGestureEventHandler DoubleTap

Event Data

The DoubleTap event's data class is DataGridGestureEventArgs. The following properties provide information specific to this event:

PropertyDescription
ElementGets the value that specifies the grid element with which a user interacts.
FieldNameGets the field name of the column.
ItemGets an object that specifies a data source’s item to which the grid’s data row corresponds.
RowHandleGets the grid’s row handle. Inherited from RowEventArgs.

Remarks

The DataGridView raises the following events in response to user gestures:

|

Gesture

|

Event

| | --- | --- | |

Tap

|

Tap and TapConfirmed

| |

Double Tap

|

Tap and DoubleTap

| |

LongPress

|

LongPress

|

The event parameter’s Element property allows you to obtain the element that was tapped.

If a user interacts with a data row, the Item property returns the data source’s item object to which that row corresponds. To obtain the tapped row handle, use the RowHandle property. If a user double taps a data row that is not selected, the DataGridView.SelectionChanged event is also raised.

Example

This example shows how to create a custom view for the grid’s edit form and set up the grid to invoke this form when a user double taps a cell.

The grid is bound to a collection of Employee objects and contains columns to display employee information (photo, name, position, phone, address, hire and birth dates, access level, and information about vacation). A custom edit form will display an employee’s photo and name, and contain editors to modify employee’s phone and address.

Custom Edit Form

Grid Columns

Follow the steps below to implement a custom edit form.

  1. Define a data template to be a content for the edit form page. In this example, it is a Xamarin.Forms.Grid with a set of labels and editors inside. Its BindingContext is an EditRowViewModel object. Use its Item property to access an object that represents a data source’s record (Employee) and bind editors to its properties.

  2. In the grid’s DoubleTap event handler, create an EditFormPage instance and pass the specified data template to its constructor as a third parameter.

  3. In the App.xaml.cs file, assign a NavigationPage instance to the Application.MainPage property and add the MainPage content page to the navigation stack (the application’s root page):

View Example

See Also

DataGridView Class

DataGridView Members

DevExpress.XamarinForms.DataGrid Namespace