Version

StateRequired Property

Gets/sets the required state. These are bit flags that specify the state that the control MUST be in for this mapping to be active.
Syntax
'Declaration
 
Public Shadows Property StateRequired As UltraTreeState
public new UltraTreeState StateRequired {get; set;}
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