Other DevExpress WinForms Cheat Sheets.
DevExpress Data-Aware controls (Gantt Control, Data Grid, Tree List, Scheduler, Vertical Grid etc) can display data from any data source that implements the IList, IBindingList, or ITypedList interface. As such, our controls are compatible with various .Net data access technologies including ADO.NET, Entity Framework, XPO, etc.
Refer to these help topics:
Note that Large Data Sources: Server and Instant Feedback Modes impose certain restrictions on data binding. In Server/Instant Feedback mode we have a separate data source for every supported data access technology.
Data Grid (or any other DevExpress data-aware control) shows data from its source as is. If you wish to display records that were filtered/sorted or merge multiple data sources, you need to do that at the data source level before you bind a data-aware control to this source.
Data-aware controls also don't apply any data-editing restrictions by default. Instead they take all restrictions from the underlying data source. So, if a column in the underlying data source is not editable, it won't be editable in data-aware controls as well.
To bind data-aware controls to Dynamic objects you can create a custom data source that implements the standard ITypedList interface and returns information about the objects stored in the data source. Alternatively, you can use UnboundSource or Unbound Columns. With this approach you create any number of columns dynamically and supply data to these columns via events. Refer to the following KB article to get started:
Show Values from External Sources, Use Formulas and Expressions to Calculate Field Values, Work in Unbound Mode
Examples
Can I migrate to a different data source (for example, from Entity Framework 6 to EF Core)? Will there be any limitations?]
The object you are using as your data source should implement the IList, IBindingList, or ITypedList interface. EF Core meets this requirement, and as such is fully supported by DevExpress data-aware controls. Refer to these help topics: Traditional Data Binding Methods and Data Binding Common Concepts.
Can I bind a Data-Aware control to generic collections?
If your collection implements the IList, IBindingList, or ITypedList interface, it can serve as a data-source for DevExpress data-aware controls. Refer to these help topics: Traditional Data Binding Methods and Data Binding Common Concepts
Can I use stored procedures to access data on the server?
You can access data in any suitable way. To show it in the Grid, store it in a ADO.NET data set or any collection that implements the IList, IBindingList, or ITypedList interface. Refer to these help topics: Traditional Data Binding Methods and Data Binding Common Concepts.
How to get a count of all records (including hidden ones) in Data-Aware controls?
Use methods of the underlying data source.
How to display and edit XML data in Data Grid?
Data-aware controls can display data from any data source that implements the IList, IBindingList, or ITypedList interface. So, you can serialize this XML data to a collection or DataTable and then assign it to the Grid. To store modified data, convert the modified data source back to an XML file and rewrite the original XML file.
I want records selected in one Data Grid to be shown in another Data Grid. Can I do this?
Bind Data Grid #2 (that shows rows selected in Grid #1) to any collection that supports the IList, IBindingList, or ITypedList interface, e.g. BindingList or DataTable When a row is selected, the ColumnView.SelectionChanged event is raised. Handle this event for the Grid #1 and add or remove rows to/from the datasource of the Grid #2.