Skip to content

Bind data from a List, BindingLIst and ReadOnlyCollection objects to the worksheet range.

License

Notifications You must be signed in to change notification settings

DevExpress-Examples/wpf-spreadsheet-bind-a-worksheet-to-generic-list-or-bindinglist-data-source

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WPF Spreadsheet: How to Bind a Worksheet to a Generic List or a BindingList Data Source

This example demonstrates the use of List, BindingList, and ReadOnlyCollection objects as data sources to bind data to the worksheet range.

image

Implementation Details

The WorksheetDataBindingCollection.BindToDataSource method is called to create the binding.

The ExternalDataSourceOptions object specifies various data binding options. A custom converter with the IBindingRangeValueConverter interface converts weather data between the data source and a worksheet. 

If the data source does not allow modification (ReadOnlyCollection<T>), the binding worksheet range also prevents modification. To modify the data obtained from the read-only data source, use the WorksheetExtensions.Import method instead of data binding.

Note

The use of the WorksheetExtensions.Import method in production code (and referencing the DevExpress.Docs assembly) requires a license to the DevExpress Document Server or the DevExpress Universal Subscription.

Data binding error fires the WorksheetDataBinding.Error event and cancels the data update. The event handler in this example displays a message containing the error type.

Files to Review

C# Visual Basic
MainWindow.xaml MainWindow.xaml
MainWindow.xaml.cs MainWindow.xaml.vb
MyConverter.cs MyConverter.vb
WeatherReport.cs WeatherReport.vb

Documentation

About

Bind data from a List, BindingLIst and ReadOnlyCollection objects to the worksheet range.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •