xtrareports-401991-feature-guide-to-devexpress-reports-use-report-controls-bind-report-controls-to-data-migrate-from-legacy-data-bindings-to-expressions.md
The legacy data binding mode enables you to assign a single data field to a report control’s binding properties.
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.
The following differences apply to the Bindings and Expressions modes:
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.
You can select a report control and bind it to data in the Properties panel.
See the Bind Report Controls to Data topic for more information.
|
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.
|
|
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.
|
|
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.
|
|
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.
|
The built-in report conversion tool helps you convert your legacy reports to expressions. This tool runs in the following scenarios:
The conversion dialog appears when you set the static UserDesignerOptions.ConvertBindingsToExpressions property to PromptBoolean.Prompt (the default value) and open a report that uses legacy data bindings.
Report conversion runs when you set the UserDesignerOptions.ConvertBindingsToExpressions property to PromptBoolean.True.
Use the Report Designer Options dialog to set the ConvertBindingsToExpressions property at design time in Visual Studio.
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;
// ...
}
}
Module Program
Private Sub Main()
DevExpress.XtraReports.Configuration.Settings.Default.UserDesignerOptions.ConvertBindingsToExpressions =
DevExpress.XtraReports.UI.PromptBoolean.True
' ...
End Sub
End Module
You cannot convert a report from legacy bindings to expressions in the following cases: