Infragistics(R) NetAdvantage(R) Windows Forms
SetHeaderCheckedState(RowsCollection,Boolean) Method
See Also  Example E-mail your feedback on this topic.
Infragistics.Win.UltraWinGrid Namespace > UltraGridColumn Class > SetHeaderCheckedState Method : SetHeaderCheckedState(RowsCollection,Boolean) Method

rows
RowsCollection containing the header to be changed
check
Indicates if the header checkbox should be checked
Sets the CheckState of the Header of the provided RowsCollection.

Syntax

Visual Basic (Declaration) 
Public Overloads Sub SetHeaderCheckedState( _
   ByVal rows As RowsCollection, _
   ByVal check As Boolean _
) 
C# 
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.

Visual BasicCopy Code
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
C#Copy Code
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);
}

See Also