Skip to main content

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.v24.2.dll

NuGet Package: DevExpress.Reporting.Core

Declaration

public class XRBinding :
    IXRBinding,
    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 sample Northwind database.

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;
}

Implements

DevExpress.XtraReports.IXRBinding

Inheritance

Object
XRBinding
See Also