Skip to main content

XRCheckBox.TextFormatString Property

Specifies the output format for a value bound to the checkbox.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v24.2.dll

NuGet Package: DevExpress.Reporting.Core

Declaration

[Browsable(true)]
public override string TextFormatString { get; set; }

Property Value

Type Description
String

The output format for a value bound to the checkbox.

Remarks

The TextFormatString property allows you to specify an output format for values bound to the XRCheckBox‘s Text property.

Note

Ensure the specified format string fits the type of the bound value. For instance, in the code example below the expression {0:(####)-####} expects the id field to be an integer. This expression does not work for other types, for example for strings. Refer to the following article for more details on formatting: Format types in .NET.

Example

The following code example shows how to specify the TextFormatString property for the XRCheckBox control.

Note

Refer to the following help topic for information on how to format data at design time: Format Data.

using DevExpress.XtraReports.UI;
using DevExpress.DataAccess.Json;
// ...
string json = "{\"products\":[{\"id\":12341234},{\"id\":56785678}]}";

// Create a checkbox.
XRCheckBox checkbox = new XRCheckBox() {
    // Specify an expression for the checkbox's "Text" property.
    ExpressionBindings = { new ExpressionBinding("BeforePrint", "Text", "[id]") },
    // Specify a format string for the checkbox's text.
    TextFormatString = "{0:(####)-####}"
};

// Create a report with the checkbox.
XtraReport report = new XtraReport() {
    Bands = {
        new DetailBand() {
            HeightF = 15,
            Controls = {checkbox}
        }
    },
    DataSource = new JsonDataSource() {
        JsonSource = new CustomJsonSource(json)
    },
    DataMember = "products"
};

See Also