Version

SetHeaderCheckedState(RowsCollection,Boolean) Method

Sets the CheckState of the Header of the provided RowsCollection.
Syntax
'Declaration
 
Public Overloads Sub SetHeaderCheckedState( _
   ByVal rows As RowsCollection, _
   ByVal check As Boolean _
) 
public void SetHeaderCheckedState( 
   RowsCollection rows,
   bool check
)

Parameters

rows
RowsCollection containing the header to be changed
check
Indicates if the header checkbox should be checked
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