xtrareports-devexpress-dot-xtrareports-dot-configuration-dot-userdesigneroptions.md
Specifies the binding mode used to provide dynamic content to reports.
Namespace : DevExpress.XtraReports.Configuration
Assembly : DevExpress.XtraReports.v25.2.dll
NuGet Package : DevExpress.Reporting.Core
public DataBindingMode DataBindingMode { get; set; }
Public Property DataBindingMode As DataBindingMode
| Type | Description |
|---|---|
| DataBindingMode |
A DataBindingMode enumeration value.
|
Available values:
| Name | Description |
|---|---|
| Bindings |
The legacy data binding mode, in which providing any custom logic to the report requires report scripts.
| | Expressions |
The default binding mode that allows you to provide expressions with restricted customization options (only the XRControl.BeforePrint event is available).
| | ExpressionsAdvanced |
The binding mode that allows you to provide expressions in both the XRControl.BeforePrint and XRControl.PrintOnPage event handlers. See Use Variables for Event-Related Expressions.
|
You can access this nested property as listed below:
| Object Type | Path to DataBindingMode |
|---|---|
| ReportingSettings |
.UserDesignerOptions .DataBindingMode
| | Settings |
.UserDesignerOptions .DataBindingMode
|
The DataBindingMode property is available in the Report Designer Options dialog in Visual Studio at design time.
Set the DataBindingMode property at the application’s startup to specify the default binding mode for an End-User Report Designer:
WinForms
static class Program {
static void Main() {
DevExpress.XtraReports.Configuration.Settings.Default.UserDesignerOptions.DataBindingMode =
DevExpress.XtraReports.UI.DataBindingMode.ExpressionsAdvanced;
// ...
}
}
Module Program
Private Sub Main()
DevExpress.XtraReports.Configuration.Settings.Default.UserDesignerOptions.DataBindingMode =
DevExpress.XtraReports.UI.DataBindingMode.ExpressionsAdvanced
' ...
End Sub
End Module
WPF
public partial class App : Application {
protected override void OnStartup(StartupEventArgs e) {
DevExpress.XtraReports.Configuration.Settings.Default.UserDesignerOptions.DataBindingMode =
DevExpress.XtraReports.UI.DataBindingMode.ExpressionsAdvanced;
base.OnStartup(e);
}
}
Public Partial Class App
Inherits Application
Protected Overrides Sub OnStartup(ByVal e As StartupEventArgs)
DevExpress.XtraReports.Configuration.Settings.Default.UserDesignerOptions.DataBindingMode =
DevExpress.XtraReports.UI.DataBindingMode.ExpressionsAdvanced
MyBase.OnStartup(e)
End Sub
End Class
ASP.NET
public class Global : System.Web.HttpApplication {
protected void Application_Start(Object sender, EventArgs e) {
DevExpress.XtraReports.Configuration.Settings.Default.UserDesignerOptions.DataBindingMode =
DevExpress.XtraReports.UI.DataBindingMode.ExpressionsAdvanced;
//...
}
}
Public Class [Global]
Inherits System.Web.HttpApplication
Protected Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
DevExpress.XtraReports.Configuration.Settings.[Default].UserDesignerOptions.DataBindingMode =
DevExpress.XtraReports.UI.DataBindingMode.ExpressionsAdvanced
' ...
End Sub
End Class
See the Data Binding Modes document for more information about available binding modes.
The following code snippets (auto-collected from DevExpress Examples) contain references to the DataBindingMode property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
reporting-web-customize-web-report-wizard/CS/WebFormsWizardCustomization/Global.asax.cs#L9
System.Web.Routing.RouteTable.Routes.MapPageRoute("defaultRoute", "", "~/Default.aspx");
DevExpress.XtraReports.Configuration.Settings.Default.UserDesignerOptions.DataBindingMode = DevExpress.XtraReports.UI.DataBindingMode.Expressions;
DevExpress.XtraReports.Web.WebDocumentViewer.Native.WebDocumentViewerBootstrapper.SessionState = System.Web.SessionState.SessionStateBehavior.Default;
reporting-winforms-bind-mdb-with-select-query/CS/RuntimeBindingToMdbDatabase/Form1.cs#L63
// Specify labels' bindings depending on the report's data binding mode.
if (Settings.Default.UserDesignerOptions.DataBindingMode == DataBindingMode.Bindings) {
label1.DataBindings.Add("Text", null, "selectQuery.CategoryName");
reporting-winforms-bind-to-csv-file/CS/BindingReportToCsvFile/Form1.cs#L52
// Specify the label's binding depending on the data binding mode.
if (Settings.Default.UserDesignerOptions.DataBindingMode == DataBindingMode.Bindings)
label.DataBindings.Add("Text", null, "CategoryName");
reporting-wpf-create-report-in-code/CS/RuntimeReportsApplication/MainWindow.xaml.cs#L93
// Bind the label to the CategoryName data field depending on the report's data binding mode.
if (DevExpress.XtraReports.Configuration.Settings.Default.UserDesignerOptions.DataBindingMode == DataBindingMode.Bindings)
labelDetail.DataBindings.Add("Text", report.DataSource, "queryCategories.CategoryName", "Category: {0}");
reporting-winforms-filter-report-data-query/CS/QueryParametersRuntime/XtraReport1.cs#L48
// Bind report controls to appropriate data fields depending on the report's data binding mode.
if (Settings.Default.UserDesignerOptions.DataBindingMode == DataBindingMode.Bindings) {
xrLabel1.DataBindings.Add("Text", ds, "Products.CategoryID");
reporting-winforms-bind-mdb-with-select-query/VB/RuntimeBindingToMdbDatabase/Form1.vb#L55
Dim DesignerOptions = DevExpress.XtraReports.Configuration.Settings.Default.UserDesignerOptions
If DesignerOptions.DataBindingMode = DataBindingMode.Bindings Then
label1.DataBindings.Add("Text", Nothing, "selectQuery.CategoryName")
reporting-winforms-bind-to-csv-file/VB/BindingReportToCsvFile/Form1.vb#L38
' Specify the label's binding depending on the data binding mode.
If Settings.Default.UserDesignerOptions.DataBindingMode = DataBindingMode.Bindings Then
label.DataBindings.Add("Text", Nothing, "CategoryName")
reporting-winforms-bind-excel-runtime/VB/BindingReportToExcelWorkbook/Form1.vb#L47
' Specify the label's binding depending on the data binding mode.
If Settings.Default.UserDesignerOptions.DataBindingMode = DataBindingMode.Bindings Then
label.DataBindings.Add("Text", Nothing, "CategoryName")
reporting-wpf-create-report-in-code/VB/RuntimeReportsApplication/MainWindow.xaml.vb#L102
' Bind the label to the CategoryName data field depending on the report's data binding mode.
If DevExpress.XtraReports.Configuration.Settings.Default.UserDesignerOptions.DataBindingMode = DataBindingMode.Bindings Then
labelDetail.DataBindings.Add("Text", report.DataSource, "queryCategories.CategoryName", "Category: {0}")
reporting-winforms-filter-report-data-query/VB/QueryParametersRuntime/XtraReport1.vb#L46
' Bind report controls to appropriate data fields depending on the report's data binding mode.
If Settings.Default.UserDesignerOptions.DataBindingMode = DataBindingMode.Bindings Then
xrLabel1.DataBindings.Add("Text", ds, "Products.CategoryID")
See Also