Skip to main content

XRControl.ExpressionBindings Property

Provides access to a control’s collection of expression bindings.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v23.1.dll

NuGet Package: DevExpress.Reporting.Core


public virtual ExpressionBindingCollection ExpressionBindings { get; }

Property Value

Type Description

An ExpressionBindingCollection object.


A binding expression enables you to specify a property value for a control or a parameter.

To create a binding expression for a report control, create an ExpressionBinding object, specify its properties, and add the ExpressionBinding object to the XRControl.ExpressionBindings collection.

The ExpressionBinding constructor needs the following arguments:

The name of the event whose handler evaluates the expression. Typically you should set this property to the “BeforePrint” (the BeforePrint event) or “PrintOnPage” (the PrintOnPage event) string. If you omit this property, the expression is evaluated in the BeforePrint event. You can use the [Arguments.PageIndex] value to get the current page index in the expression evaluated in the PrintOnPage event.
The property to which the expression applies.
A binding expression that is parsed and processed to specify a control or parameter’s property value.

The following code snippet specifies an expression for a control’s property:

using DevExpress.XtraReports.UI;

public partial class XtraReport1 : DevExpress.XtraReports.UI.XtraReport {
    public XtraReport1() {

        XRLabel label = new XRLabel();
        label.LeftF = 100;
        label.TopF = 100;
        // Specify an expression that sets the label's Text to the current date. The expression is rendered within the BeforePrint event.
        label.ExpressionBindings.Add(new ExpressionBinding("Text", "TODAY()"));
        // Specify an expression that makes the text bold on the first page.
        label.ExpressionBindings.Add(new ExpressionBinding("PrintOnPage", "Font.Bold", "Iif([Arguments.PageIndex] == 0, true, false)"));

The following code specifies a custom expression for the label’s XRControl.Text property. The code assumes that the report is bound to a data source with UnitPrice and UnitsInStock fields.

using DevExpress.XtraReports.UI;

public XtraReport1() {
    // ...
    ExpressionBinding expressionBinding = new ExpressionBinding("BeforePrint", "Text", "[UnitPrice]*[UnitsInStock]");

Review the following topic for more information: Data Binding Modes.


See Also