Back to Devexpress

UserDesignerOptions.DataBindingMode Property

xtrareports-devexpress-dot-xtrareports-dot-configuration-dot-userdesigneroptions.md

latest11.6 KB
Original Source

UserDesignerOptions.DataBindingMode Property

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

Declaration

csharp
public DataBindingMode DataBindingMode { get; set; }
vb
Public Property DataBindingMode As DataBindingMode

Property Value

TypeDescription
DataBindingMode

A DataBindingMode enumeration value.

|

Available values:

NameDescription
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.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to DataBindingMode
ReportingSettings

.UserDesignerOptions .DataBindingMode

| | Settings |

.UserDesignerOptions .DataBindingMode

|

Remarks

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

csharp
static class Program {
    static void Main() {
        DevExpress.XtraReports.Configuration.Settings.Default.UserDesignerOptions.DataBindingMode = 
            DevExpress.XtraReports.UI.DataBindingMode.ExpressionsAdvanced;
        // ...
    }
}
vb
Module Program
    Private Sub Main()
        DevExpress.XtraReports.Configuration.Settings.Default.UserDesignerOptions.DataBindingMode = 
            DevExpress.XtraReports.UI.DataBindingMode.ExpressionsAdvanced
        ' ...
    End Sub
End Module

WPF

csharp
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);
    }
}
vb
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

csharp
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;
        //... 
    }
}
vb
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

csharp
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

csharp
// 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

csharp
// 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

csharp
// 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

csharp
// 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

vb
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

vb
' 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

vb
' 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

vb
' 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

vb
' 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

Data Binding Modes

UserDesignerOptions Class

UserDesignerOptions Members

DevExpress.XtraReports.Configuration Namespace