XRLabel.TextFormatString Property
Specifies the output format for the label’s text.
Namespace: DevExpress.XtraReports.UI
Assembly: DevExpress.XtraReports.v17.2.dll
NuGet Package: DevExpress.Reporting.Core
Declaration
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.