Bind to Data

  • 2 minutes to read

You can bind the GridControl to any object that implements the IEnumerable interface or its descendant (for example, IList, ICollection). To bind the control to data, you should assign a data source to the grid’s DataControlBase.ItemsSource property:

<Window xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" ...>
    <dxg:GridControl ItemsSource="{Binding Customers}" AutoGenerateColumns="AddNew"/>
</Window>

Concepts

Examples

The following example shows how to bind the WPF Data Grid to different data sources.

View Example: Bind the WPF Data Grid to Data

This example includes multiple solutions that demonstrate:

  • How to bind the Data Grid to Entity Framework, EF Core, and XPO.
  • Different binding mechanisms: virtual sources, server mode sources, and local data.
  • MVVM and code-behind patterns.

After you bind the Data Grid to a database, you can implement CRUD operations (create, read update, delete). Refer to the following topic for more information: CRUD Operations in a Data-Bound Grid.

View Example: Implement CRUD Operations in the WPF Data Grid

More Examples