windowsforms-devexpress-dot-xtraeditors-dot-checkbutton-bc1bab6f.md
Gets or sets the button’s group index. Within a group, only one button may be checked at a time. When users click another button in a group, the checked state moves from the current button to the clicked one.
Namespace : DevExpress.XtraEditors
Assembly : DevExpress.XtraEditors.v25.2.dll
NuGet Package : DevExpress.Win.Navigation
[DefaultValue(-1)]
[DXCategory("Behavior")]
public virtual int GroupIndex { get; set; }
<DXCategory("Behavior")>
<DefaultValue(-1)>
Public Overridable Property GroupIndex As Integer
| Type | Default | Description |
|---|---|---|
| Int32 | -1 |
A non-negative integer value that specifies the button’s group index. -1 to exclude the button from groups.
|
To combine buttons into a logical group, set their GroupIndex properties to the same non-negative value. If the GroupIndex property is set to -1 , the button does not belong to any group.
The code sample below illustrates how to group several check buttons into two groups:
checkButtonWantsToImprove.GroupIndex = 0;
checkButtonDoesntWantToImprove.GroupIndex = 0;
checkButtonStudentLevelBeginner.GroupIndex = 1;
checkButtonStudentLevelIntermediate.GroupIndex = 1;
checkButtonStudentLevelAdvanced.GroupIndex = 1;
checkButtonWantsToImprove.GroupIndex = 0
checkButtonDoesntWantToImprove.GroupIndex = 0
checkButtonStudentLevelBeginner.GroupIndex = 1
checkButtonStudentLevelIntermediate.GroupIndex = 1
checkButtonStudentLevelAdvanced.GroupIndex = 1
To allow users to uncheck the checked button, set its CheckButton.AllowAllUnchecked property to true.
To respond to a button’s state change, handle the CheckButton.CheckedChanged event.
See Also