GridOptionsNavigation.EnterMoveNextColumn Property
Gets or sets whether the Enter key moves focus to the next cell.
Namespace: DevExpress.XtraGrid.Views.Grid
Assembly: DevExpress.XtraGrid.v24.2.dll
Declaration
Property Value
Type | Default | Description |
---|---|---|
Boolean | false | true if the Enter key moves focus to the next cell; otherwise, false. |
Property Paths
You can access this nested property as listed below:
Object Type | Path to EnterMoveNextColumn |
---|---|
GridView |
|
WinExplorerView |
|
Remarks
When the user presses the Enter key in an active editor, the changes are saved and the editor closes. Set the EnterMoveNextColumn
property to false to automatically move focus to the next row cell and activate its editor. Note that focus is moved even if the next cell cannot be edited.
Multi-line editors use the Enter key to return the carriage, not to save changes. If the next cell uses the MemoEdit (or MemoExEdit) multi-line editor, set the AcceptsReturn (or AcceptsReturn) property to false to prevent the editor from handling the Enter key.
The New Item Row allows users to add a new row. To display the New Item Row, use the GridView.OptionsView.NewItemRowPosition property.
When a user presses the Enter key in this row, focus always moves to the next cell regardless of the EnterMoveNextColumn
property value. When the user presses the Enter key in the last cell, a new row is created. To create a new row when the user presses the Enter key in any cell, not only in the last one, handle the ProcessGridKey event as shown below.
using DevExpress.XtraGrid;
using DevExpress.XtraGrid.Views.Grid;
gridControl.ProcessGridKey += GridControl_ProcessGridKey;
private void GridControl_ProcessGridKey(object sender, KeyEventArgs e) {
var view = (sender as GridControl).MainView as GridView;
if (e.KeyCode == Keys.Enter && view.IsNewItemRow(view.FocusedRowHandle)) {
view.PostEditor();
view.UpdateCurrentRow();
e.Handled = true;
}
}