xtrareports-devexpress-dot-xtrareports-dot-ui-dot-xrcheckbox-83468df3.md
Gets or sets a value indicating whether the check box is checked.
Namespace : DevExpress.XtraReports.UI
Assembly : DevExpress.XtraReports.v25.2.dll
NuGet Package : DevExpress.Reporting.Core
[DefaultValue(false)]
[SRCategory(ReportStringId.CatData)]
public bool Checked { get; set; }
<SRCategory(ReportStringId.CatData)>
<DefaultValue(False)>
Public Property Checked As Boolean
| Type | Default | Description |
|---|---|---|
| Boolean | false |
true if the check box is checked; otherwise, false.
|
Use the Checked property to specify whether a XRCheckBox is checked (displays a check mark) or not (is empty).
Note
If the Checked property is set to true and the XRCheckBox.CheckBoxState property is set to the Indeterminate value, the check box displays a shaded check mark.
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;
}
Imports DevExpress.XtraReports.UI
' ...
Public Function CreateXRCheckBox() As XRCheckBox
' Creates an XRCheckBox object.
Dim xrCheckBox1 As New XRCheckBox()
xrCheckBox1.ExpressionBindings.AddRange(New ExpressionBinding() {
' Binds the CheckState 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(150.0F, 20.0F)
Return xrCheckBox1
End Function
See Also