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]Data Binding
   [Collapse]Views
    [Collapse]Grid View
      Columns
      Unbound Columns
      Rows
      Cells
     Banded Grid Views
    [Expand]Card and Layout Views
     WinExplorer View
    [Expand]Tile View
   [Expand]Data Editing and Validation
   [Expand]Grouping
   [Expand]Sorting
   [Expand]Filter and Search
   [Expand]Summaries
   [Expand]Focus and Selection Handling
    Formatting Cell Values
   [Expand]Master-Detail Relationships
   [Expand]Asynchronous Image Load
   [Expand]Export and Printing
   [Expand]Appearance and Conditional Formatting
    Split Presentation
    Row Preview Sections
    Scrolling
   [Expand]Batch Modifications
   [Expand]Hit Information
    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]ASP.NET Core 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]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Rows

Expanded Row Height

There are two types of rows in the Data Grid: data rows (that represent data source records) and non-data service rows (group rows, new item rows, etc.).

By default, row height is determined by font settings. The Data Grid provides the following API to modify these heights.

  • GridView.RowHeight
    Specifies the data row height in pixels. The default value is -1 and rows have no constant height.

  • GridView.ColumnPanelRowHeight
    Specifies the height of column headers.

  • GridView.GroupRowHeight
    Gets or sets the group rows' height.

  • GridView.RowSeparatorHeight
    Specifies the vertical distance between rows. Setting this property to zero does not remove horizontal lines between rows. To do that, disable the GridOptionsView.ShowHorizontalLines setting.

  • GridView.CalcRowHeight
    This event repeatedly rises for every row and allows you to set individual height parameters for each of them. The code snippet below illustrates how to set row heights based on values from the "RowHeight" data source field.

Expanded Auto Row Height

By default, row cells clip content that they cannot display entirely. To change this behavior, utilize the MemoEdit, TokenEdit or PictureEdit editors as in-place editors for required columns and enable the GridOptionsView.RowAutoHeight setting. This will allow Data Grid data rows to dynamically adapt to the content and gain different heights.

Demo: Auto Row Height

Expanded Hide Horizontal Row Borders

You can hide column and row borders by disabling the GridOptionsView.ShowVerticalLines and GridOptionsView.ShowHorizontalLines settings.

Expanded Row Indicator Panel

A row indicator panel is a horizontal strip docked to the Data Grid's left edge. End-users can click this bar to select any Data Grid row.

Row indicator panel displays various icons depending on what row is currently selected and which row operation is ongoing.
  • - the focused row.
  • - a row cell is being edited by an end-user.
  • - the row has been modified.
  • - the focused row is a new item row.
  • - the focused row is an auto-filter row.
  • - end-users can click this icon to maximize a detail View.
  • - end-users can click this icon to restore a detail View.
  • - the row contains errors.
  • - the focused row contains errors.
Related API

Expanded Row Multi-Select

If the ColumnViewOptionsSelection.MultiSelect option is enabled, end-users are able to select multiple rows using marquee selection, keyboard arrow keys and mouse clicks with the Ctrl/Shift keys pressed.

Expanded Web Style Row Selection

Along with clicking a row indicator panel, end-users can utilize check boxes to select data rows. To enable these check boxes, set the GridOptionsSelection.MultiSelectMode property to the GridMultiSelectMode.CheckBoxRowSelect value. Web style selection is available only when row multi-select is on.

Related API

Demo: Web Style Row Selection

Expanded Accessing Rows in Code. Row Handles

Every Data Grid row has three integer values that identify it: a data source index, a row handle and a visible index.

Data source indexes

  • Specify zero-based row indexes in the bound list.
  • Constant values that do not change when you sort, group or filter data.
  • For group rows, they will point to the first data row in the group.
  • Used for accessing data.

Row handles

  • Zero-based indexes that correspond to row order from top to bottom.
  • Group row handles are negative values that start with -1. The order matches the order of group rows from top to bottom.
  • The grid specifies reserved row handles for the New Item Row, Auto Filter Row and an Invalid Row.
  • Row handles are re-assigned to rows after each data operation.
  • When the View is filtered, rows and row handles are created only for rows that match the filter.

Visible indexes

  • Zero-based indexes that match the order of visible rows, from top to bottom.
  • Service rows get negative indexes if displayed above data and group rows.
  • Re-assigned after each data operation, including data sorting, grouping and filtering.
  • Visible indexes are only assigned to rows in expanded groups. Thus, the indexes are updated after each expand/collapse operation.

For master-detail data, all detail Views have their own unique visible indexes and row handles.

Related API

Expanded Traversing Rows

When you need to process all Data Grid rows one-by-one, use the following approach.

  • Read the BaseView.DataRowCount property value to determine the actual number of existing rows.
  • To alter all existing rows, implement a loop that goes over row handles starting from 0 to DataRowCount - 1.
  • If you need to process visible rows only, begin with a row that has a zero handle and then obtain the next rows by calling the ColumnView.GetNextVisibleRow method.
  • Wrap your loop inside the ColumnView.BeginSort/ColumnView.EndSort methods pair to prevent reloading data while processing rows is still in progress. Otherwise, changing cell values may change a row order (together with row handles), which will cause your row processing algorithm to malfunction.

The code sample below reduces values of all cells that belong to the "Price" column by 10 percent.

Expanded See Also

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