Selecting Data Cells

  • 2 minutes to read

Pivot Grid provides properties that allow data cells to be selected via code. Selected data can be copied to the Clipboard and pasted into other applications (e.g. MS Excel, MS Word).

The ability to select multiple data cells is determined by the PivotGridOptionsSelection.CellSelection option. These options can be accessed via the Pivot Grid Control's PivotGridControl.OptionsSelection property. When this option is enabled, multiple cells can be selected in the following ways.

  • using a mouse;
  • using key combinations;
  • via code.

End-users can select cells with a mouse or keyboard (see the Selecting Cells topic of the End-User Capabilities section).

The information on cells displayed by a Pivot Grid Control is returned by the PivotGridControl.Cells property. The returned object's PivotGridCells.Selection property returns a Rectangle object that contains coordinates of selected cells. The Left and Right properties identify the leftmost and rightmost columns that contain selected cells. The topmost and bottommost rows that contain selected cells are identified by the Top and Bottom properties, respectively.


If the PivotGridOptionsSelection.MultiSelect option is enabled, an end-user can select multiple blocks of cells via a mouse with the Ctrl key pressed down.


To access Pivot Grid Control's multiple selection, use the PivotGridCells.MultiSelection property. The code below shows how to select cells in code.

pivotGridControl1.Cells.MultiSelection.SetSelection(new Point[] {
    new Point(0, 0), new Point(0, 1), new Point(2, 0) });


Appearance settings used to paint selected cells are specified by the PivotGridAppearances.SelectedCell property.

After cell selection has been changed, the PivotGridControl.CellSelectionChanged event is raised.

See Also