Version

GetHeaderCheckedState Method

Returns the current CheckState for the Header
Syntax
'Declaration
 
Public Function GetHeaderCheckedState( _
   ByVal rows As RowsCollection _
) As CheckState
public CheckState GetHeaderCheckedState( 
   RowsCollection rows
)

Parameters

rows
The RowsCollection used to find the associated Header.

Return Value

Returns CheckState based on the Header CheckBox's Checked property
Example
This snippet demonstrates how to retrieve and set the CheckState of the Header CheckBox.

Private Sub ToggleHeaderCheckBox(ByRef column As UltraGridColumn, ByRef rows As RowsCollection) 
    
    ' Return if no UltraGridColumn is supplied 
    ' 
    If column Is Nothing Then 
        Exit Sub 
    End If 
    
    
    ' Flag to indicate the current check state 
    ' 
    Dim isChecked As Boolean = False 
    
    
    ' Retrieve the current CheckState of the Header CheckBox for the provided RowsCollection, 
    ' and set the isChecked flag 
    ' 
    Select Case column.GetHeaderCheckedState(rows) 
        Case CheckState.Checked 
            isChecked = True 
            Exit Select 
        Case CheckState.Unchecked 
            isChecked = False 
            Exit Select 
        Case Else 
            Exit Sub 
    ' Do nothing if Indeterminate 
    End Select 
    
    
    ' Set the CheckState of the Header CheckBox 
    ' 
    column.SetHeaderCheckedState(rows, Not isChecked) 
End Sub
private void ToggleHeaderCheckBox(UltraGridColumn column, RowsCollection rows)
{

    // Return if no UltraGridColumn is supplied
    //
    if (column == null)
        return;


    // Flag to indicate the current check state
    //
    bool isChecked = false;


    // Retrieve the current CheckState of the Header CheckBox for the provided RowsCollection,
    // and set the isChecked flag
    //
    switch (column.GetHeaderCheckedState(rows))
    {
        case CheckState.Checked:
            isChecked = true;
            break;
        case CheckState.Unchecked:
            isChecked = false;
            break;
        default:
            // Do nothing if Indeterminate
            return;
    }
    

    // Set the CheckState of the Header CheckBox
    //
    column.SetHeaderCheckedState(rows, !isChecked);
}
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