Skip to main content

PivotGridCells.SetSelectionByFieldValues(Boolean, Object[], PivotGridFieldBase) Method

Selects cells that reside within the specified column or row, identified by the specified data field.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.XtraPivotGrid.v23.2.dll

NuGet Package: DevExpress.Win.PivotGrid

Declaration

public void SetSelectionByFieldValues(
    bool isColumn,
    object[] values,
    PivotGridFieldBase dataField
)

Parameters

Name Type Description
isColumn Boolean

true to select cells within a column; false to select cells within a row.

values Object[]

An array of field values that identifies the column or row that should be selected.

dataField PivotGridFieldBase

A PivotGridFieldBase descendant. Specifies a data field that identifies the column or row that should be selected.

Remarks

If the specified field value array identifies several columns, the SetSelectionByFieldValues method selects all of them.

Use the null (Nothing in Visual Basic) value to identify the Grand Total column or row.

Consider the following pivot grid.

SetSelectionByFieldValues

The table below demonstrates how to use the SetSelectionByFieldValues method to select columns and rows.

C# Visual Basic Selected Column(s)
pivotGridControl.Cells.SetSelectionByFieldValues(true, new object[] {1994, 8}, fieldUnitPrice); pivotGridControl.Cells.SetSelectionByFieldValues(True, New Object() {1994, 8}, fieldUnitPrice) 0
pivotGridControl.Cells.SetSelectionByFieldValues(true, new object[] {1994, 8}, fieldQuantity); pivotGridControl.Cells.SetSelectionByFieldValues(True, New Object() {1994, 8}, fieldQuantity) 3
pivotGridControl.Cells.SetSelectionByFieldValues(true, new object[] {1994}, fieldUnitPrice); pivotGridControl.Cells.SetSelectionByFieldValues(True, New Object() {1994}, fieldUnitPrice) 0 - 2
pivotGridControl.Cells.SetSelectionByFieldValues(true, new object[] {}, fieldQuantity); pivotGridControl.Cells.SetSelectionByFieldValues(True, New Object() {}, fieldQuantity) 3 - 5
pivotGridControl.Cells.SetSelectionByFieldValues(true, new object[] {null}, fieldQuantity); pivotGridControl.Cells.SetSelectionByFieldValues(True, New Object() {Nothing}, fieldQuantity) 7
See Also