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.v19.2.dll

Declaration

[Browsable(true)]
public override string TextFormatString { get; set; }
<Browsable(True)>
Public Overrides Property TextFormatString As String

Property Value

Type Description
String

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

Remarks

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.ExpressionBindings.Add(expressionBinding);
    xrLabel1.TextFormatString = "{0:c2}";
}

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

See Also