Skip to main content

How to: Bind a GridControl to a DataTable

  • 2 minutes to read

Important

This documentation topic describes legacy technology. We no longer develop new functionality for the GridControl and suggest that you use the new DataGridView control instead.

This example demonstrates how to use a DataTable from an iOS and Android projects as a data source for GridControl. The table below lists projects of the solution, files contained in these projects and added assembly references.

Project

Files

References

PCL

MainPage.xaml.cs, MainPage.xaml - The MainPage content page with a grid will be the start page of the application. Its Data property is used to set a data source for the grid via GridControl.ItemsSource.

DataTableSample.cs - The App class specifies MainPage as the start page of the application. The MainPage.Data property is bound to the App.Data property.

SampleData.cs - A DataTable property of the SampleData class returns a DataTable instance populated with data. This file is located in the PCL project folder but it is not included in the PCL project. A link to this file is added to the iOS and Android projects.

DevExpress.Mobile.Grid.v18.2.dll

DevExpress.Mobile.Core.v18.2.dll

iOS

AppDelegate.cs - Initializes platform libraries of the GridControl. Creates an App class instance and sets its Data property to a DataTable instance. Passes the created App class instance to the LoadApplication method which starts your application.

A link to the SampleData.cs file - Specifies DataTable to be a data source for the grid.

DevExpress.Mobile.Core.iOS.v18.2.dll

DevExpress.Mobile.Grid.iOS.v18.2.dll

System.Data.dll

Android

MainActivity.cs - Initializes platform libraries of the GridControl. Creates an App class instance and sets its Data property to a DataTable instance. Passes the created App class instance to the LoadApplication method which starts your application.

A link to the SampleData.cs file - Specifies DataTable to be a data source for the grid.

DevExpress.Mobile.Core.Android.v18.2.dll

DevExpress.Mobile.Grid.Android.v18.2.dll

System.Data.dll