Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

XRCheckBox.CheckBoxState Property

Bindable. Gets or sets the current state of the XRCheckBox control.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v24.2.dll

NuGet Package: DevExpress.Reporting.Core

#Declaration

[DefaultValue(CheckBoxState.Unchecked)]
[SRCategory(ReportStringId.CatData)]
public CheckBoxState CheckBoxState { get; set; }

#Property Value

Type Default Description
CheckBoxState Unchecked

An enumeration value that determines the state of a checkbox.

Available values:

Name Description
Unchecked

The check box is unchecked.

Checked

The check box is checked.

Indeterminate

A visual state that signals to the user that the control state cannot be determined.

#Remarks

The following image shows the checkbox control in different states:

XRCheckBox.CheckBoxState


#Example

The following code sample creates the XRCheckBox control and binds its state to a data field.

using DevExpress.XtraReports.UI;
// ...

public XRCheckBox CreateXRCheckBox()
{
    // Creates the XRCheckBox control.
    XRCheckBox xrCheckBox1 = new XRCheckBox();

    xrCheckBox1.ExpressionBindings.AddRange(new ExpressionBinding[] {
    // Binds the CheckBoxState property to the UnitsInStock data field.
    new ExpressionBinding("BeforePrint", "CheckBoxState", "Iif([UnitsInStock]>=1,\'Checked\', \'Unchecked\')"),
    // Changes the control's text depending on the UnitsInStock data field value.
    new ExpressionBinding("BeforePrint", "Text", 
                          "Iif([UnitsInStock]>0,\'Units in Stock: \' + [UnitsInStock], \'None\')")});

    // Set the control size.
    xrCheckBox1.SizeF = new SizeF(150F, 20F);

    return xrCheckBox1;
}
See Also