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.v18.1.dll

Declaration

public class XRBinding :
    IXRBinding,
    IXRSerializable,
    IDisposable,
    ICloneable,
    IDataContainerBase
Public Class XRBinding
    Implements IXRBinding,
               IXRSerializable,
               IDisposable,
               ICloneable,
               IDataContainerBase

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.

Examples

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

Inheritance

Object
XRBinding

Implements

DevExpress.XtraReports.IXRBinding
DevExpress.Data.IDataContainerBase

Inherited Members

System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()

See Also