xtrareports-devexpress-dot-xtrareports-dot-ui-ffb73fa9.md
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.v25.2.dll
NuGet Package : DevExpress.Reporting.Core
public class XRBinding :
IXRBinding,
IDisposable,
ICloneable,
IDataContainerBase
Public Class XRBinding
Implements IXRBinding,
IDisposable,
ICloneable,
IDataContainerBase
The following members return XRBinding objects:
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.
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:
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;
}
Imports DevExpress.XtraReports.UI
' ...
Public Function CreateBoundLabel()
' Create a label.
Dim label As New XRLabel()
' Create a data binding object.
Dim binding As 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
End Function
DevExpress.XtraReports.IXRBinding
Object XRBinding
See Also