Version

KeyActionMappings Property (UltraTree)

Returns the TreeKeyActionMappings instance which contains instances of the TreeKeyActionMapping class, each of which define the action that is associated with a given keystroke.
Syntax
'Declaration
 
Public ReadOnly Property KeyActionMappings As TreeKeyActionMappings
public TreeKeyActionMappings KeyActionMappings {get;}
Remarks

The default keyboard behavior for the UltraTree control is determined by the contents of the TreeKeyActionMappings collection when the control is instantiated. Keyboard behavior can be modified by removing the mappings that appear by default, as well as adding custom ones.

KeyActionMapping objects can be modified, deleted, or added to change the keyboard behavior of the control.

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

KeyCode ActionCode StateRequired StateDisallowed SpecialKeysRequired SpecialKeysDisallowed
Right NextNode NodeHasChildren InEdit, NodeExpandable, ActiveCell None AltCtrl
Left ParentNode NodeChild InEdit, NodeExpanded, ActiveCell None AltCtrl
Up PrevNode None InEdit, ActiveCell None AltCtrl
Down NextNode None InEdit, ActiveCell None AltCtrl
Home FirstNode None InEdit, ActiveCell None AltCtrl
End LastNode None InEdit, ActiveCell None AltCtrl
Right ExpandNode NodeExpandable InEdit, ActiveCell None Alt
Left CollapseNode NodeExpanded InEdit, ActiveCell None Alt
Prior PageUp None InEdit, ActiveCell None AltCtrl
Next PageDown None InEdit, ActiveCell None AltCtrl
Escape ExitEditMode InEdit CellInEditMode None Alt
Enter ExitEditModeAndSave InEdit CellInEditMode None AltCtrl
F2 EnterEditMode None InEdit, ActiveCell None Alt
F2 ExitEditModeAndSave InEdit CellInEditMode None Alt
Multiply ExpandAllNode None InEdit, ActiveCell None All
Add ExpandNode NodeExpandable InEdit, ActiveCell None Alt
Subtract CollapseNode NodeExpanded InEdit, ActiveCell None Alt
Back ParentNode NodeChild InEdit, ActiveCell None AltCtrl
Space ToggleSelection None InEdit, ActiveCell Ctrl Alt
Space ClearAllSelectedNodes None InEdit, ActiveCell None AltCtrl
Space SelectActiveNode None InEdit, ActiveCell None AltCtrl
Space ToggleCheckbox IsCheckbox InEdit, ActiveCell None AltCtrl
Space CheckOptionButton IsOptionButton InEdit, ActiveCell None AltCtrl
Delete DeleteNodes None InEdit, ActiveCell None AltCtrl
Right ExpandNode NodeExpandable InEdit, ActiveCell Ctrl Alt
Left CollapseNode NodeExpanded InEdit, ActiveCell Ctrl Alt
Up PrevNodeNoSelect None InEdit, ActiveCell Ctrl Alt
Down NextNodeNoSelect None InEdit, ActiveCell Ctrl Alt
Home FirstNodeNoSelect None InEdit, ActiveCell Ctrl Alt
End LastNodeNoSelect None InEdit, ActiveCell Ctrl Alt
Prior PageUpNoSelect None InEdit, ActiveCell Ctrl Alt
Next PageDownNoSelect None InEdit, ActiveCell Ctrl Alt
X Cut AllowCut InEdit, ActiveCell Ctrl AltShift
C Copy AllowCopy InEdit, ActiveCell Ctrl AltShift
V Paste AllowPaste InEdit, ActiveCell Ctrl AltShift
Delete Cut AllowCut InEdit, ActiveCell Shift AltCtrl
Insert Copy AllowCopy InEdit, ActiveCell Ctrl AltShift
Insert Paste AllowPaste InEdit, ActiveCell Shift AltCtrl
Left NoAction None InEdit, NodeChild, NodeExpanded, ActiveCell None AltCtrl
Right NoAction None InEdit, NodeHasChildren, ActiveCell None AltCtrl
Left ParentNode NodeChild, NodeExpanded InEdit, NodeHasChildren, ActiveCell None AltCtrl
Right NextNode ActiveCell, ActiveCellIsInLastLogicalColumn CellInEditMode, NextNodeDisplaysCells None All
Down NextNode ActiveCell, ActiveCellIsOnLastLogicalRow CellInEditMode, NextNodeDisplaysCells None All
Left PrevNode ActiveCell, ActiveCellIsInFirstLogicalColumn CellInEditMode, PreviousNodeDisplaysCells None All
Up PrevNode ActiveCell, ActiveCellIsOnFirstLogicalRow CellInEditMode, PreviousNodeDisplaysCells None All
Home FirstCellInNode ActiveCell CellInEditMode, FirstCellActive None All
End LastCellInNode ActiveCell CellInEditMode, LastCellActive None All
Home FirstCellInNodesCollection FirstCellActive CellInEditMode None All
End LastCellInNodesCollection LastCellActive CellInEditMode None All
Home FirstCellInTree ActiveCell CellInEditMode Ctrl AltShift
End LastCellInTree ActiveCell CellInEditMode Ctrl AltShift
End LastCellInTree ActiveCell CellInEditMode Ctrl AltShift
Right NextCell ActiveCell CellInEditMode None All
Left PreviousCell ActiveCell CellInEditMode None All
Up AboveCell ActiveCell CellInEditMode None All
Down BelowCell ActiveCell CellInEditMode None All
F2 EnterEditModeOnCell ActiveCell CellInEditMode None All
F2 ExitEditModeOnCellSaveChanges ActiveCell, CellInEditMode None None All
Escape UndoCellEdit ActiveCell, CellInEditMode None None All
Escape UndoNodeEdit HasNodeChangesPending InEdit, CellInEditMode None All
Tab SelectNextControl LastCellActive, LastNodeActive TabKeyNavigatesToNextCell, TabKeyNavigatesToNextControl None All
Tab SelectPreviousControl FirstCellActive, FirstNodeActive TabKeyNavigatesToNextCell, TabKeyNavigatesToNextControl Shift AltCtrl
Tab NextCellEnterEditMode ActiveCell None None All
Tab PreviousCellEnterEditMode ActiveCell None Shift AltCtrl
Space DeactivateCell ActiveCell CellInEditMode Ctrl AltShift
Space FirstCellInNode ActiveNodeDisplaysCells ActiveCell Ctrl AltShift

Example
The following code illustrates how to add a custom key/action mappings to the tree that will toggle the expanded state of the active node when the user presses the ‘X’ key (unless the ‘alt’ key is also pressed).

Imports Infragistics.Win.UltraWinTree

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

    Dim newAction As TreeKeyActionMapping

    ' Add 2 KeyActionMappings so that if the user presses
    ' the 'X' key (without also pressing the 'Alt' key)
    ' the active node will toggle its expanded state.

    ' The first mapping states that if the node is expandable
    ' and its not already expanded or in edit mode and the
    ' user presses the 'X' key then expand the node.
    newAction = New TreeKeyActionMapping( _
       Keys.X, _
       UltraTreeAction.ExpandNode, _
       UltraTreeState.InEdit Or UltraTreeState.NodeExpanded, _
       UltraTreeState.NodeExpandable, _
       Infragistics.Win.SpecialKeys.Alt, _
         0)

    Me.ultraTree1.KeyActionMappings.Add(newAction)

    ' The first mapping states that if the node is expanded
    ' and its not in edit mode and the user presses the 'X' 
    ' key then collapse the node.
    newAction = New TreeKeyActionMapping( _
       Keys.X, _
       UltraTreeAction.CollapseNode, _
       UltraTreeState.InEdit, _
       UltraTreeState.NodeExpanded, _
       Infragistics.Win.SpecialKeys.Alt, _
         0)

    Me.ultraTree1.KeyActionMappings.Add(newAction)

End Sub
using System.Diagnostics;
using Infragistics.Win.UltraWinTree;

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

	// Add 2 KeyActionMappings so that if the user presses
	// the 'X' key (without also pressing the 'Alt' key)
	// the active node will toggle its expanded state.

	// The first mapping states that if the node is expandable
	// and its not already expanded or in edit mode and the
	// user presses the 'X' key then expand the node.
	 this.ultraTree1.KeyActionMappings.Add(
		new TreeKeyActionMapping( 
					// the key code
					Keys.X,
					// the action to take
					UltraTreeAction.ExpandNode,
					// disallowed state
					UltraTreeState.InEdit | UltraTreeState.NodeExpanded, 
					// required state 
					UltraTreeState.NodeExpandable, 
					// disallowed special keys
					Infragistics.Win.SpecialKeys.Alt, 
					// required special keys (none)
					0 ) );

	// The first mapping states that if the node is expanded
	// and its not in edit mode and the user presses the 'X' 
	// key then collapse the node.
	this.ultraTree1.KeyActionMappings.Add(
		new TreeKeyActionMapping( 
					// the key code
					Keys.X,
					// the action to take
					UltraTreeAction.CollapseNode,
					// disallowed state
					UltraTreeState.InEdit, 
					// required state
					UltraTreeState.NodeExpanded, 
					// disallowed special keys
					Infragistics.Win.SpecialKeys.Alt, 
					// required special keys (none)
					0 ) );

}
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