Skip to main content
A newer version of this page is available. .

XRBinding Class

A simple binding between the property value of an object and the property value of an instance of the XRControl class or one of its descendants.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v20.1.dll

NuGet Packages: DevExpress.Reporting.Core, DevExpress.WindowsDesktop.Reporting.Core

Declaration

public class XRBinding :
    IXRBinding,
    IXRSerializable,
    IDisposable,
    ICloneable,
    IDataContainerBase

Remarks

Use the XRBinding class to create and maintain a simple binding between an object’s property and a property of the control that represents the XRControl class or one of its descendants.

Example

The following example demonstrates how to create a binding of the XRBinding class, and add it to a control’s binding collection. The constructor method takes four arguments:

  • “Text” - the name of the control’s property to be bound,
  • dsOrders1 - the data source used,
  • “Orders.OrderDate” - a string containing a navigation path resolving to the property of an object,
  • “{0:MM/dd/yyyy}” - a string containing the bound value’s format (date/time format in this case).

Note that for this example to work correctly, a report must contain the dsOrders dataset, which should use data in the Orders table (“SELECT Orders.* FROM Orders”) from the demo Northwind database (nwind.mdb file located in the directory, where you installed DevExpress demos).

using DevExpress.XtraReports.UI;
// ...

public XRLabel CreateBoundLabel() {
    // Create a label.
    XRLabel label = new XRLabel();

    // Create a data binding object.
    XRBinding binding = new XRBinding("Text", dsOrders1, "Orders.OrderDate", "{0:MM/dd/yyyy}");

    // Add the data binding to the label's collection of bindings.
    label.DataBindings.Add(binding);

    return label;
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the XRBinding class.

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.

Implements

DevExpress.XtraReports.IXRBinding
DevExpress.Data.IDataContainerBase

Inheritance

Object
XRBinding
See Also