Skip to main content

CheckButton.GroupIndex Property

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.v24.2.dll

Declaration

[DefaultValue(-1)]
[DXCategory("Behavior")]
public virtual int GroupIndex { get; set; }

Property Value

Type Default Description
Int32 -1

A non-negative integer value that specifies the button’s group index. -1 to exclude the button from groups.

Remarks

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;

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