Version

CurrentState Property (UltraGrid)

Returns bit flags that signify the current editing state of the control.
Syntax
'Declaration
 
Public ReadOnly Property CurrentState As UltraGridState
public UltraGridState CurrentState {get;}
Remarks
The CurrentState property is used primarily in conjunction with the KeyActionMappingsKeyActionMappings property and the PerformAction(UltraGridAction) method to return information about the state of the control with regards to user interaction. The setting of the CurrentState property indicates which object has focus in the control, whether the user has placed the control into edit mode, and other information such as whether a combo box is dropped down or whether a row is expanded.
Example
The following code illustrates how to test what state a grid is in and to perform an action based on the current state, it this case enter edit mode if a cell is selected.

Imports Infragistics.Win.UltraWinGrid

Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click

    Dim state As UltraGridState

    ' Get the current state of the grid
    state = Me.ultraGrid1.CurrentState

    ' Check the state bit flags to see if the 'InEdit' bit is set
    If ((state And UltraGridState.InEdit) = 0) Then
        ' since we aren't in edit mode check the bit that
        ' determines if a cell is selected. If it is then
        ' call perform action to enter edit mode
        If ((state And UltraGridState.Cell) = UltraGridState.Cell) Then
            Me.ultraGrid1.PerformAction(UltraGridAction.EnterEditMode)
        End If
    End If

    ' 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 button1_Click(object sender, System.EventArgs e)
{

	// Get the current state of the grid
	UltraGridState state = this.ultraGrid1.CurrentState;

	// Check the state bit flags to see if the 'InEdit' bit is set
	if ( ( state & UltraGridState.InEdit ) == 0 )
	{
		// since we aren't in edit mode check the bit that
		// determines if a cell is selected. If it is then
		// call perform action to enter edit mode
		if ( ( state & UltraGridState.Cell ) == UltraGridState.Cell )
			this.ultraGrid1.PerformAction( UltraGridAction.EnterEditMode );
	}

	// 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