Back to Devexpress

CheckButton.GroupIndex Property

windowsforms-devexpress-dot-xtraeditors-dot-checkbutton-bc1bab6f.md

latest2.7 KB
Original Source

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

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DefaultValue(-1)]
[DXCategory("Behavior")]
public virtual int GroupIndex { get; set; }
vb
<DXCategory("Behavior")>
<DefaultValue(-1)>
Public Overridable Property GroupIndex As Integer

Property Value

TypeDefaultDescription
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:

csharp
checkButtonWantsToImprove.GroupIndex = 0;
checkButtonDoesntWantToImprove.GroupIndex = 0;
checkButtonStudentLevelBeginner.GroupIndex = 1;
checkButtonStudentLevelIntermediate.GroupIndex = 1;
checkButtonStudentLevelAdvanced.GroupIndex = 1;
vb
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

AllowAllUnchecked

Checked

CheckButton Class

CheckButton Members

DevExpress.XtraEditors Namespace