Version

KeyActionMappings Property (UltraGrid)

Gives you the ability to reconfigure the way the control responds to user keystrokes.
Syntax
'Declaration
 
Public ReadOnly Property KeyActionMappings As GridKeyActionMappings
public GridKeyActionMappings KeyActionMappings {get;}
Remarks

The KeyActionMappings property provides access to the control's mechanism for handling keyboard input from users. All keystrokes for actions such as selection, navigation and editing are stored in a table-based system that you can examine and modify using this property. Through the KeyActionsMappings property, you can customize the keyboard layout of the control to match your own standards for application interactivity.

For example, if you wanted users to be able to navigate between cells by pressing the F8 key, you could add this behavior. You can specify the key code and any special modifier keys associated with an action, as well as determine whether a key mapping applies in a given context.

The following table lists the default key mappings for the UltraGrid control:

KeyCode ActionCode StateRequired StateDisallowed SpecialKeysRequired SpecialKeysDisallowed
Right NextCell Cell InEdit AltCtrl
Tab NextCellByTab Cell All
Left PrevCell Cell InEdit AltCtrl
Tab PrevCellByTab Cell Shift AltCtrl
Up AboveCell Cell InEdit Alt
Down BelowCell Cell InEdit Alt
Home FirstRowInBand Row Cell AltCtrl
End LastRowInBand Row Cell AltCtrl
Right FirstRowInGrid Row Alt
Down FirstRowInGrid Row Alt
Home FirstRowInGrid Row Cell Ctrl Alt
End LastRowInGrid Row Cell Ctrl Alt
Right ExpandRow RowExpandable Cell, RowExpanded Alt
Left CollapseRow RowExpanded Cell Alt
Right NextRow Row Cell, RowExpandable Alt
Right NextRow Row, RowExpanded Cell Alt
Tab NextRowByTab Row Cell, LastRowInGrid All
Left PrevRow Row Cell, RowExpanded Alt
Tab PrevRowByTab Row Cell, FirstRowInGrid Shift AltCtrl
Up AboveRow Row Cell Alt
Down BelowRow Row Cell Alt
Space ToggleCheckbox InEdit, IsCheckbox All
Space ToggleCellSel Cell InEdit All
Space ToggleRowSel Row Cell All
Space DeactivateCell Cell Ctrl AltShift
Space ActivateCell Row Cell Ctrl AltShift
Right NextCellInBand Cell InEdit Ctrl Alt
Left PrevCellInBand Cell InEdit Ctrl Alt
Home FirstCellInRow Cell CellFirst, InEdit AltCtrl
End LastCellInRow Cell CellLast, InEdit AltCtrl
Home FirstCellInBand CellFirst InEdit AltCtrl
End LastCellInBand CellLast InEdit AltCtrl
Home FirstCellInGrid Cell InEdit Ctrl Alt
End LastCellInGrid Cell InEdit Ctrl Alt
Prior PageUpCell Cell InEdit Alt
Next PageDownCell Cell InEdit Alt
Prior PageUpRow Row Cell Alt
Next PageDownRow Row Cell Alt
Escape UndoCell InEdit IsDroppedDown Alt
Escape UndoRow Row, RowDirty InEdit Alt
Enter ExpandRow GroupByRow IsDroppedDown, RowExpanded Alt
Enter CollapseRow RowExpanded, GroupByRow IsDroppedDown Alt
F4 ToggleDropdown HasDropdown, InEdit Alt
Up ToggleDropdown HasDropdown, InEdit Alt
Down ToggleDropdown HasDropdown, InEdit Alt
F2 ToggleEditMode Cell SwapDroppedDown Alt
F4 EnterEditModeAndDropdown HasDropdown InEdit Alt
Up EnterEditModeAndDropdown HasDropdown InEdit Alt
Down EnterEditModeAndDropdown HasDropdown InEdit Alt
F6 NextRegion InEdit All
F6 PrevRegion InEdit Shift AltCtrl
Delete DeleteRows Row InEdit All
Right NextCellInBand Cell, InEdit, IsCheckbox
Left PrevCellInBand Cell, InEdit, IsCheckbox
Up AboveCell Cell, InEdit, IsCheckbox
Down BelowCell Cell, InEdit, IsCheckbox

Example
The following code illustrates how to add a custom key/action mapping to the grid that will navigate to the first row in the grid when the grid has focus but is not in edit mode and the users presses the ‘H’ key (unless the ‘alt’ key is also pressed).

Imports Infragistics.Win.UltraWinGrid

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

     Dim newMapping As GridKeyActionMapping

    ' Add a custom key/action mapping to the grid that 
    ' will navigate to the first row in the grid when 
    ' the grid has focus but is not in edit mode 
    ' and the users presses the ‘H’ key (unless the
    ' 'alt’ key is also pressed). 
    newMapping = New GridKeyActionMapping(Keys.H, UltraGridAction.FirstRowInGrid, UltraGridState.InEdit, 0, Infragistics.Win.SpecialKeys.Alt, 0)

    Me.ultraGrid1.KeyActionMappings.Add(newMapping)

    ' Note: The concept applies to UltraCombo controls as
    ' well except that the combo's KeyActionMappings is
    ' a collection of a mapping class, and associated
    ' state and actiion flags, that make sense for a combo
    ' (i.e. ComboKeyActionMapping, UltraComboAction and
    ' UltraComboState.

End Sub
using Infragistics.Win.UltraWinGrid;

private void Form1_Load(object sender, System.EventArgs e)
{

	this.oleDbDataAdapter1.Fill( this.dataSet11 );

	// Add a custom key/action mapping to the grid that 
	// will navigate to the first row in the grid when 
	// the grid has focus but is not in edit mode 
	// and the users presses the ‘H’ key (unless the
	// 'alt’ key is also pressed). 
	this.ultraGrid1.KeyActionMappings.Add( 
		new GridKeyActionMapping( 
			// the key code
			Keys.H,
			// the action to take
			UltraGridAction.FirstRowInGrid,
			// disallowed state
			UltraGridState.InEdit, 
			// required state (none)
			0, 
			// disallowed special keys
			Infragistics.Win.SpecialKeys.Alt, 
			// required special keys (none)
			0 ) );

	// Note: The concept applies to UltraCombo controls as
	// well except that the combo's KeyActionMappings is
	// a collection of a mapping class, and associated
	// state and actiion flags, that make sense for a combo
	// (i.e. ComboKeyActionMapping, UltraComboAction and
	// UltraComboState.

}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also