BarCheckItem.CheckStyle Property
Gets or sets the check box style. This property is not in effect for BarCheckItems displayed within sub-menus and popup menus.
Namespace: DevExpress.XtraBars
Assembly: DevExpress.XtraBars.v24.2.dll
Declaration
[DefaultValue(BarCheckStyles.Standard)]
[DXCategory("Appearance")]
public BarCheckStyles CheckStyle { get; set; }
Property Value
Type | Default | Description |
---|---|---|
DevExpress.XtraBars.BarCheckStyles | Standard | A BarCheckStyles enumerator value that specifies the check box style. |
Remarks
BarCheckItems displayed within bars and Ribbon controls do not initially have check boxes. Set the BarCheckItem.CheckBoxVisibility property to BeforeText or AfterText to show check boxes to the left or right of item captions.
To show radio buttons instead of check boxes, set the CheckStyle property to Radio.
The CheckStyle property only specifies the check box visual style (check box or radio button). This property does not combine BarCheckItems in a radio group. To create a radio group, set the GroupIndex property for each item to the same value.
Note
You cannot use the CheckStyle property to apply the Radio style to BarCheckItems displayed within sub-menus and popup menus.
Example
The following code combines two BarCheckItems in a radio group.
private void Form1_Load(object sender, EventArgs e) {
int colorRadioGroupValue1 = 11;
barCheckItem1.Caption = "Black";
barCheckItem1.CheckBoxVisibility = CheckBoxVisibility.BeforeText;
barCheckItem1.CheckStyle = BarCheckStyles.Radio;
barCheckItem1.GroupIndex = colorRadioGroupValue1;
barCheckItem1.CheckedChanged += BarCheckItem_CheckedChanged;
barCheckItem2.Caption = "White";
barCheckItem2.CheckBoxVisibility = CheckBoxVisibility.BeforeText;
barCheckItem2.CheckStyle = BarCheckStyles.Radio;
barCheckItem2.GroupIndex = colorRadioGroupValue1;
barCheckItem2.CheckedChanged += BarCheckItem_CheckedChanged;
barCheckItem2.Checked = true;
}
private void BarCheckItem_CheckedChanged(object sender, ItemClickEventArgs e) {
BarCheckItem checkItem = sender as BarCheckItem;
MessageBox.Show(checkItem.Caption);
}