A newer version of this page is available. Switch to the current version.

XRLabel.TextFormatString Property

Specifies the output format for the label's bound value (provided by the applied expression, data binding or summary).

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v18.2.dll


public override string TextFormatString { get; set; }
Public Overrides Property TextFormatString As String

Property Value

Type Description

A string containing the output format for the label's text.


When the UserDesignerOptions.DataBindingMode is set to DataBindingMode.Expressions or DataBindingMode.ExpressionsAdvanced, you can format the label's XRControl.Text property value using the TextFormatString property.

The following code snippet demonstrates how to specify a custom expression for a label's text and apply a currency format. This code assumes that a report is bound to a data source containing the UnitPrice and UnitsInStock fields.

using DevExpress.XtraReports.UI;

public XtraReport1() {
    // ...
    ExpressionBinding expressionBinding = new ExpressionBinding("BeforePrint", "Text", "[UnitPrice]*[UnitsInStock]");
    xrLabel1.TextFormatString = "{0:c2}";

See the Formatting Data document to learn about applying formats at design time.

See Also