Back to Devexpress

Worksheet.DataBindings Property

officefileapi-devexpress-dot-spreadsheet-dot-worksheet-005f916a.md

latest4.2 KB
Original Source

Worksheet.DataBindings Property

Provides access to the collection of WorksheetDataBinding objects.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
WorksheetDataBindingCollection DataBindings { get; }
vb
ReadOnly Property DataBindings As WorksheetDataBindingCollection

Property Value

TypeDescription
WorksheetDataBindingCollection

A WorksheetDataBindingCollection object that is the collection of all data bindings specified in a worksheet.

|

Remarks

Use the DataBindings property to get access to the WorksheetDataBindingCollection collection, which stores all data bindings specified in a worksheet. To bind a cell range in a worksheet to a data source, use the WorksheetDataBindingCollection.BindToDataSource method.

To use a cell range as a data source for a data-aware control, create a data source object from the required cell range using the WorksheetDataBindingCollection.CreateDataSource method.

For more information on the data binding functionality of the SpreadsheetControl, refer to the Data Binding topic.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the DataBindings property.

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.

wpf-spreadsheet-bind-a-worksheet-to-generic-list-or-bindinglist-data-source/CS/DataBindingToListExample/MainWindow.xaml.cs#L100

csharp
private void barBtnUnbind_ItemClick(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e) {
    foreach (WorksheetDataBinding wdb in spreadsheetControl1.Document.Worksheets[0].DataBindings)
        wdb.Range.FillColor = System.Drawing.Color.Empty;

wpf-spreadsheet-bind-a-worksheet-to-generic-list-or-bindinglist-data-source/VB/DataBindingToListExample/MainWindow.xaml.vb#L99

vb
Private Sub barBtnUnbind_ItemClick(ByVal sender As Object, ByVal e As DevExpress.Xpf.Bars.ItemClickEventArgs)
    For Each wdb As WorksheetDataBinding In spreadsheetControl1.Document.Worksheets(0).DataBindings
        wdb.Range.FillColor = System.Drawing.Color.Empty

See Also

Data Binding in WinForms Spreadsheet Control

WinForms Spreadsheet Control Examples

Worksheet Interface

Worksheet Members

DevExpress.Spreadsheet Namespace