Back to Devexpress

XRBindingCollection.Add(String, Object, String, String) Method

xtrareports-devexpress-dot-xtrareports-dot-ui-dot-xrbindingcollection-dot-add-x28-system-dot-string-system-dot-object-system-dot-string-system-dot-string-x29.md

latest4.7 KB
Original Source

XRBindingCollection.Add(String, Object, String, String) Method

Creates an XRBinding object and adds it to the collection.

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
public XRBinding Add(
    string propertyName,
    object dataSource,
    string dataMember,
    string formatString
)
vb
Public Function Add(
    propertyName As String,
    dataSource As Object,
    dataMember As String,
    formatString As String
) As XRBinding

Parameters

NameTypeDescription
propertyNameString

The name of the control’s property to bind.

| | dataSource | Object |

An object that represents the data source.

| | dataMember | String |

A string containing a navigation path resolving to the property of an object.

| | formatString | String |

A string containing a format of the value to be bound.

|

Returns

TypeDescription
XRBinding

An XRBinding object.

|

The following code snippets (auto-collected from DevExpress Examples) contain references to the Add(String, Object, String, String) method.

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-winforms-use-a-custom-function-in-query-expression/CS/SelectQueryWindowsFormsApplication/Form1.cs#L48

csharp
XRLabel labelCategory = new XRLabel();
labelCategory.DataBindings.Add("Text", report.DataSource, "Products.CategoryID", "Category ID: {0}");
labelCategory.TopF = 15;

reporting-wpf-create-report-in-code/CS/RuntimeReportsApplication/MainWindow.xaml.cs#L94

csharp
if (DevExpress.XtraReports.Configuration.Settings.Default.UserDesignerOptions.DataBindingMode == DataBindingMode.Bindings)
    labelDetail.DataBindings.Add("Text", report.DataSource, "queryCategories.CategoryName", "Category: {0}");
else labelDetail.ExpressionBindings.Add(

reporting-winforms-use-a-custom-function-in-query-expression/VB/SelectQueryWindowsFormsApplication/Form1.vb#L45

vb
Dim labelCategory As New XRLabel()
labelCategory.DataBindings.Add("Text", report.DataSource, "Products.CategoryID", "Category ID: {0}")
labelCategory.TopF = 15

reporting-wpf-create-report-in-code/VB/RuntimeReportsApplication/MainWindow.xaml.vb#L103

vb
If DevExpress.XtraReports.Configuration.Settings.Default.UserDesignerOptions.DataBindingMode = DataBindingMode.Bindings Then
    labelDetail.DataBindings.Add("Text", report.DataSource, "queryCategories.CategoryName", "Category: {0}")
Else

See Also

XRBindingCollection Class

XRBindingCollection Members

DevExpress.XtraReports.UI Namespace