Focusing Cells and Scrolling

  • 2 minutes to read

Pivot Grid provides properties that enable you to move focus to desired cells automatically, so that end-users do not need to navigate through cells themselves. A focused cell’s contents can be copied to the Clipboard and pasted into other applications (e.g. MS Excel, MS Word).

This topic provides information on moving focus between cells at runtime and scrolling Pivot Grid Control contents in code.

Focusing Cells

The information on cells displayed by a Pivot Grid Control is returned by the PivotGridControl.Cells property. The returned object’s PivotGridCells.FocusedCell property allows focused cells to be obtained. This property’s value is represented by the Point structure whose X and Y properties identify the column and row of a focused cell, respectively.

A focused cell is painted with a dotted rectangle around it if the PivotGridOptionsViewBase.DrawFocusedCellRect property is set to true. Appearance settings used to paint focused cells are specified by the PivotGridAppearances.FocusedCell property.

After a focused cell has been changed, the PivotGridControl.FocusedCellChanged event is raised.

Scrolling

To scroll Pivot Grid Control contents in code, use the PivotGridControl.LeftTopCoord property that specifies column and row indexes of a data cell displayed in the top left corner. The minimum scroll step is one column (when scrolling horizontally) and one row (when scrolling vertically).

Use the PivotGridOptionsBehavior.HorizontalScrolling property to specify how the PivotGrid control is scrolled horizontally (only the data area or the entire control).

See Also