Skip to main content
All docs
V24.2

Migrate from Legacy Data Bindings to Expressions

  • 3 minutes to read

The legacy data binding mode enables you to assign a single data field to a report control’s binding properties.

report-before-print-script-event-property-grid-visual-studio

If your reports use the legacy data binding mode, consider migrating to Expression Bindings. This enables you to specify complex expressions that include two or more data fields, report parameters, or functions. You can also use expressions to calculate summaries of any complexity, or hide report controls or change their appearance.

Note

You cannot convert reports from expressions back to legacy bindings.

Binding Mode Comparison

The following differences apply to the Bindings and Expressions modes:

Bind Controls to a Single Data Field

  • Both the Bindings and Expressions modes allow you to drop fields from the Field List onto the design surface or report controls.

  • The control’s smart tag enables you to select a data field from the drop-down list.

    Data Bindings

    Expression Bindings

  • You can select a report control and bind it to data in the Properties panel.

    Data Bindings

    Expression Bindings

    Expand the (Data Bindings) category and assign a data field to the Text property.

    Switch to the Expressions tab and specify a data field to which to bind the Text property.

See the Bind Report Controls to Data topic for more information.

Bind Controls to Multiple Data Fields

Data Bindings

Expression Bindings

Use the mail merge capability.

Use the mail merge capability.

Click the Expression property’s ellipsis button and specify an expression.

Calculate Summary

Data Bindings

Expression Bindings

Select the summary function from the Summary Func drop-down list.

Select the summary function in the Expression Editor‘s Summary section.

All functions have the ‘sum’ prefix.

See Calculate a Summary for more information.

Complex Bindings, Custom Summary

Data Bindings

Expression Bindings

Use report scripts (security implications apply).

Use the Expression Editor to construct an expression of any complexity.

Refer to Calculate an Advanced Summary for an example.

Conditionally Customize Appearance

Data Bindings

Expression Bindings

Create formatting rules and assign them to report controls.

Use the Expression Editor to construct expressions for a control’s appearance and style properties.

Refer to Conditionally Change a Control’s Appearance for an example.

Convert Bindings to Expressions

The built-in report conversion tool helps you convert your legacy reports to expressions. This tool runs in the following scenarios:

Use the Report Designer Options dialog to set the ConvertBindingsToExpressions property at design time in Visual Studio.

convert-bindings-to-expressions-using-dialog

Use the following code to specify the End-User Report Designer’s ConvertBindingsToExpressions property:

static class Program {
    static void Main() {
        DevExpress.XtraReports.Configuration.Settings.Default.UserDesignerOptions.ConvertBindingsToExpressions = 
                DevExpress.XtraReports.UI.PromptBoolean.True;
        // ...
    }
}

Limitations

You cannot convert a report from legacy bindings to expressions in the following cases:

  • A report contains one or more controls bound to a data source that is not specified as the report’s data source.
  • A report contains a formatting rule whose data source differs from the report’s data source.