- Home
- Forum
- Xamarin.Forms
- Detect Enter key
Detect Enter key
Hi, Is it possible to call EndEdit() when Enter key is pressed from the mobile/tablet virtual keyboard? Thanks
SIGN IN To post a reply.
7 Replies
SS
Sivaraman Sivagurunathan
Syncfusion Team
January 25, 2018 12:57 PM UTC
Hi Wayne,
Thanks for using Syncfusion support.
We have checked your query. SfDataGrid edited GridCell gets EndEdit while tapping to another GridCell. However, you can customize and end edit the GridCell while tapping the Enter key by handling CurrentCellBeginEdit event. We have prepared a sample for your reference and you can download the same from the below link.
The below code illustrate how to call the EndEdit in enter key.
|
int currentRowIndex = -1;
public SfDataGridPage()
{
InitializeComponent();
dataGrid.CurrentCellBeginEdit += DataGrid_CurrentCellBeginEdit;
}
private async void DataGrid_CurrentCellBeginEdit(object sender, GridCurrentCellBeginEditEventArgs args)
{
await Task.Delay(100);
var row = dataGrid.GetRowGenerator().Items.FirstOrDefault(x => x.RowIndex == args.RowColumnIndex.RowIndex);
currentRowIndex = args.RowColumnIndex.RowIndex;
var column = (row.GetType().GetRuntimeProperties().FirstOrDefault(x => x.Name == "VisibleColumns").GetValue(row) as List<DataColumnBase>).FirstOrDefault(x => x.ColumnIndex == args.RowColumnIndex.ColumnIndex);
if (((column as IElement).Element as ContentView).Content is Entry)
{
(((column as IElement).Element as ContentView).Content as Entry).Completed += Entry_Completed;
}
}
private async void Entry_Completed(object sender, EventArgs e)
{
dataGrid.EndEdit();
}
|
Regards,
Sivaraman
WC
Wayne Caruana
January 25, 2018 03:02 PM UTC
Thanks for the Solution...
SK
Shivagurunathan Kamalakannan
Syncfusion Team
January 26, 2018 06:22 AM UTC
Hi Wayne,
Thanks for the update.
Please let us know, If you require for further assistance.
Regards,
Shivagurunathan. K
AL
Andy Link
February 12, 2018 03:30 PM UTC
Hi.
Thanks.
SK
Shivagurunathan Kamalakannan
Syncfusion Team
February 13, 2018 03:10 PM UTC
Hi Wayne,
Thanks for contacting Syncfusion Support,
We have checked your query. The support to end the editing by tapping the “Enter” key in GridNumrericColumn, will be included in the forth coming releases.
We appreciate your patience until then.
Regards,
Shivagurunathan. K
TC
Thomas Carney
November 16, 2021 04:37 PM UTC
This solution no longer works on either iOS or Android
SV
Suja Venkatesan
Syncfusion Team
November 17, 2021 02:35 PM UTC
Hi Thomas,
Thanks for the update.
We would like to let you know that we provide keyboard navigation support in our SfDataGrid control for Xamarin.Forms.iOS platform in 19.1.0.54 release version and for Xamarin.Forms.Android 19.2.0.44 release version. By default, pressing Enter Key when the cell is in edit mode will commit the changes to cell and selection will be moved to the next row of the same column.
Please refer the following User documentation for Keyboard behavior and Cell Editing
Keyboard behavior UG link: https://help.syncfusion.com/xamarin/datagrid/selection#keyboard-behavior
Cell Editing UG link: https://help.syncfusion.com/xamarin/datagrid/editing
Please let us know if you need further assistance.
Regards,
Suja.
SIGN IN To post a reply.
- 7 Replies
- 6 Participants
-
WC Wayne Caruana
- Jan 24, 2018 01:58 PM UTC
- Nov 17, 2021 02:35 PM UTC