Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Binding to Data
   [Expand]Grid View
   [Expand]View Technology
   [Expand]Grouping
   [Expand]Sorting
   [Expand]Summaries
   [Expand]Data Editing
   [Expand]Filtering and Locating Rows
   [Expand]Focus and Selection Handling
   [Expand]Processing Rows
   [Expand]Formatting Cell Values
   [Expand]Master-Detail Relationships
   [Expand]Asynchronous Image Load
   [Expand]Export and Printing
   [Expand]Appearance and Conditional Formatting
   [Expand]Batch Modifications
   [Expand]Hit Information
   [Expand]Hints
   [Expand]Popup Menus
   [Expand]Saving and Restoring Layouts
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]Examples
   [Expand]End-User Capabilities
    Included Components
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Data Grid

Learn the Basics


The WinForms Data Grid (GridControl) provides rich capabilities to display, shape and edit data from any data source. You can choose between the following data presentation formats (Views) in the Data Grid.

  • Traditional tabular format (Grid View)
  • Banded tabular format (Banded Grid View and Advanced Banded Grid View).
  • Cards (Layout View and Card View)
  • Tiles (Tile View)
  • Windows Explorer-inspired style (WinExplorer View)

Data shaping capabilities include, but are not limited to sorting, grouping, summary calculation, cell merging, data editing, master-detail and split presentations, as well as a rich set of filtering and data searching options such as built-in column filters and Find Panel.

You can bind to all traditional data sources. To work with large data sources, use dedicated synchronous and asynchronous server modes.

  • Data Grid and Views
    Introduces the Grid Control and its data presentation formats - Views. You will learn about the capabilities provided by Views, how to switch between Views, provide data, and customize the layout of columns, bands and card fields.

  • Included Components
    Beside the GridControl component, the Data Grid Suite also includes two GridControl-based lookup editors and the control that supports the grid's split presentation feature. Refer to the link to see a list of included components.

  • Visual Elements
    Demonstrates visual elements that the Grid Control and its Views are comprised of.

  • Examples
    Contains a large variety of task-based examples.

Binding to Data


To display data within the Data Grid, you first need to bind it to a data source. The following data binding modes are supported.

  • Binding to Multiple Data Source Types

    • ADO.NET data sets
    • SQL data
    • Entity Framework data
    • XML data
    • Excel data sources
    • LinQ To SQL
    • WCF Data Services
    • DevExpress ORM Tool (XPO)
    • Lists or arrays of objects created in code
  • Synchronous and Asynchronous Server Modes

    These are designated modes for working with large data sets. Even if your data source contains millions of records, the control's performance will be still high due to 1) loading records in small portions on demand, and 2) performing data-related operations (such as sorting, filtering and summary calculation) on the server side.

  • Unbound Columns

    This feature allows you to add columns to the grid to display custom data. Values for these columns can be calculated according to an expression or using an event.

Learn More...

View Technology


The Data Grid control uses Views to present data from a bound data source. The Views specify how records and record fields are arranged. They provide multiple edit, display, behavior and appearance options. Choose one of the following View types to render data according to your needs.

  • Grid View - Displays data in a tabular form.

  • Banded Grid View - Displays data in a tabular form and allows grouping of columns into bands.

  • Advanced Banded Grid View - Displays data in a tabular form, allows grouping columns into bands and supports complex data cell arrangements.

  • Layout View - Presents records as cards, which can be displayed in one or multiple columns, one or multiple rows, in an ellipse (carousel mode) or a single card at a time. Supports complex card field layouts, built-in groups, tabbed groups and labels.

  • Card View - Presents data records as cards, arranged down and then across. Card fields are always arranged in a single column.

  • WinExplorer View - Displays records using one of seven styles supported by MS Windows Explorer - Small, Medium, Large, Extra Large, List, Tiles and Content.

  • Tile View - Displays records using a Windows UI-inspired Tile UI. The data editing feature is supported in a separate edit form.

Learn More...

Grid View Data Layout


The most traditional tabular format, encapsulated by the Grid View, presents data source fields as columns, and data source records as rows. The following are only a subset of the features supported by the grid layout.

  • Column re-sizing and re-arranging by end-users
  • Column auto-width and best fit features
  • Fixed columns (frozen panes)
  • Split presentation
  • Row preview sections
  • Cell merging
  • Horizontal and vertical scrolling
  • Auto and custom row height
  • Runtime row resizing

Learn More...



Grouping


You and your end-users can group data against one or multiple columns in Grid Views, Banded Grid Views and Advanced Banded Grid Views.

  • An end-user can group data at runtime by dragging a column to a dedicated Group Panel
  • Data group modes: by column values or display text
  • Grouping date-time values by years, months, or into common date intervals (Today, Tomorrow, Sunday, Monday, Tuesday, Next Week, Next Month, Last Week, Last Month, etc.)
  • Implementing custom grouping using an event
  • Fixed group rows
  • API to process group rows
  • Sorting grouped data by summary values

Learn more...

Sorting


To specify the order of records in the Data Grid, you can sort data by one or more columns

  • An end-user can sort data at runtime (in Grid Views, Banded Grid Views, Advanced Banded Grid Views, Layout Views, and Card Views)
  • The Data Grid sorts its data itself and does not delegate this functionality to the underlying data source (except for server modes)
  • Sorting by values or display text
  • Implementing custom sorting algorithms using an event
  • Sorting grouped data by summary values

Learn more...

Summaries


Grid Views, Banded Grid Views and Advanced Banded Grid Views allow you to calculate multiple summary functions: the number of records, the maximum column value, a sum of column values, custom function, etc.

  • Total summaries (calculated against all rows)
  • Group summaries (calculated against grouped data).
  • Manual summary calculation
  • Selecting a summary function at runtime using a context menu
  • Multiple total summaries for a single column
  • Displaying group summaries in footers and group rows
  • Obtaining and formatting summary values
  • Sorting grouped data by summary values

Learn more...

Data Editing


In the Data Grid, you can specify the way column values are presented and edited by assigning DevExpress editors to columns. An end-user can edit records in-place and within a separate edit form. If a data source supports record adding and removing, you can perform record management in code and using a standalone or embedded Data Navigator control.

  • Adding and removing rows, in code and using a Data Navigator control
  • Editing data using 35+ in-place editors
  • Editing data in a standalone (modal) or in-line edit form
  • Modifying data in code
  • Input validation
  • Multiple editors per column

Learn more...

Filtering and Locating Rows


Multiple ways to filter and locate rows is supported. An end-user can search for data using a dedicated Find Panel (press CTRL+F), or using the incremental search feature. Filter criteria created in code or at runtime allow you to narrow the displayed record set.

  • Built-in Find Panel
  • An end-user can filter data by using column filter dropdowns
  • Regular and MS Excel-inspired filter dropdowns
  • Filter history
  • Filter editor (for creating complex filter criteria)
  • Incremental search
  • The built-in filter row
  • Filtering and locating rows API
  • Managing row visibility using an event

Learn more...

Focus and Selection


In the Data Grid control, an end-user can navigate between cells (move cell focus) using the mouse and keyboard. With a dedicated option, you can prevent certain column cells from being focused.

Row/card and cell selection can also be performed using the mouse and keyboard. In addition, to select rows in Grid Views, you can use the built-in Check column (displays checkboxes within rows).

  • Multiple Row and Cell Selection
    Provides information on single row selection, multiple row selection and multiple cell selection modes.

  • Multiple Row Selection via Built-In Check Column
    The built-in Check column provides an intuitive way to select rows with check boxes.

  • Focusing Cells
    Shows how to move focus between cells at runtime, and how to specify a focused cell's appearance.

  • Moving Row Focus
    Covers methods that enable you to move row focus by a specified number of rows forward or backward.

  • Using Navigators
    Describes navigator controls that allow end-users to browse through the grid control's data and add/delete records.

Text Formatting


To format column values in a specific manner in display and edit modes, you can assign a certain DevExpress in-place editor to the column. Column in-place editors automatically format cell values according to the editor's type and settings.

If default text formatting does not suit your needs, you can consider customizing the column's display format, or dynamically changing cell display text using an event. Note that these approaches are only in effect in display mode and aren't in effect when a cell is in edit mode.

  • Data Grid Formatting Specifics
    Shows how to customize cell display text using an event, and the standard .NET formatting mechanism (standard and custom format patterns).

  • Members that Support the Formatting Mechanism
    Enumerates properties and methods, involved in data formatting.

  • Format Specifiers
    Format specifiers are symbols that specify the way data is formatted during its conversion to a string. This topic describes frequently used standard format specifiers and custom format specifiers used to format numeric and date/time values.

  • Composite Formatting
    The Composite Formatting feature allows you to add custom text to the output formatted string.

  • Custom Formatting
    The Custom Formatting feature allows you to format values that are neither numeric, nor date/time, and implement complex formatting of numeric or date/time values. This topic explains how to implement a custom formatter.

Master-Detail


The Data Grid supports hierarchical data sources, which consist of master and detail tables (lists) linked by one-to-many relationships. Master tables can be presented by Grid Views, Banded Grid Views or Advanced Banded Grid Views, while detail tables can be presented by any of the available Views.

If records in the bound data source provide a property (or properties) of a collection type, the Data Grid automatically enables master-detail mode to render these collections.

For data sources that do not provide built-in capabilities to organize master-detail relationships on the data layer, you can realize master-detail mode using one of two approaches: implement the IRelationList interface for your data source, or handle the grid control's dedicated events.

Export and Printing


The Grid Control's data can be printed and exported to multiple formats. When exporting to MS Excel format, you can enable the data-aware export mode, which is optimized for subsequent analysis of grid data within Microsoft Excel.

Appearance and Conditional Formatting


You can change the Data Grid's look-and-feel by applying one of numerous skins. The Appearance mechanism allows you to change the colors and fonts of certain grid elements (grid columns, focused row, etc.). If you wish to highlight critical information, identify trends and compare data between cells, use the Conditional Formatting feature.

  • Look And Feel Overview
    The grid control, like all other DevExpress WinForms controls, supports the Look And Feel technology, which allows you to apply a paint theme (skin) to all controls in your application or only to individual controls.

  • Appearances
    This section shows how to customize the appearance of certain grid visual elements (rows, column headers, group panel, empty area, etc.).

  • Conditional Formats
    Inspired by Microsoft Excel, the conditional formatting feature allows you and your end-users to highlight critical information, identify trends and exceptions, and compare data by changing row and cell appearances based on custom conditions.

  • Custom Painting
    Demonstrates how to manually paint grid visual elements.

  • Alpha Blending and Background Images
    Alpha blending gives visual elements various degrees of transparency.

More Features


  • Traversing Rows
    Demonstrates two row traversing techniques - traversing through data rows and currently visible rows.

  • Asynchronous Image Load in WinExplorer and Tile Views
    By default, the Data Grid loads all data from its data source before showing it on screen. If your grid records contain images, you can speed up the application performance and make the startup feel smoother by enabling the Asynchronous Image Load feature. In this mode, the grid loads its textual data first and immediately displays it. Images are loaded in a separate thread and displayed one by one using optional visual effects.

  • Batch Modifications
    Batch modifications are designed to speed up the grid control's performance by eliminating superfluous updates (visual, re-sorting, selection updates, etc.). The main objective is to update the View only once - after all the necessary changes have been made.

  • Saving and Restoring Layouts
    The term "layout" encompasses all the settings that control the visibility and size of visual elements, their appearance settings, filter, sorting, grouping and summary information, etc. The Grid Control provides methods to save the layout to a data store (an XML file, stream or the system registry) and then to restore it. This gives you the capability to save layouts between application runs.

  • Hit Information
    Sometimes you may need to recognize which element is located at the specified screen coordinates in applications. For instance, you may have to determine which part of a View the user has clicked or double-clicked. For this purpose, Views provide the CalcHitInfo method, which accepts a point measured in grid control client coordinates and returns a Hit Info object containing information on the View element at this point.

  • Hints Overview
    When an end-user hovers with the mouse over a visual element (e.g., column or band header) with truncated text, a hint showing complete text is displayed. This section explains how to modify default hints and add your own ones.

  • Popup Menus
    The Data Grid supports built-in popup menus for column headers, row footers, and the group panel. When required, you can add your own popup menus for any grid element or customize the existing menus.

Design-Time Features


Design-time tools speed up the design process of the Data Grid control, and even allow you to create a working application from scratch without writing a single line of code.

  • Level Designer
    The Level Designer helps you to provide Views to display your data, and to easily access these Views' settings at design time. For hierarchical data sources, it allows you to assign a View for each data level.

  • Grid Designer
    The advanced Grid Designer enables you to customize Views, bands, columns, summaries, in-place editors, appearance settings, layout and other options. The Feature Browser page gathers options and events provided by Views and columns into a set of categories (features). This is the best starting point to find the settings and events related to a specific functionality.

  • On-form Band and Column Customization
    See this topic to learn about design-time on-form customization of column and band layouts supported by Grid Views, Banded Grid Views and Advanced Banded Grid Views.

End-User Capabilities


Topics in this section cover operations available to end-users at runtime.

  • Data editing
  • Controlling column, band and card field visibility
  • Re-arranging and resizing columns and bands
  • Filtering, sorting and grouping data
  • Applying summaries
  • Using the Find Panel and Incremental Search feature to locate rows, etc.

Learn more...

Expanded See Also

How would you rate this topic?​​​​​​​