Back to Devexpress

PivotGridControl.GetRowIndex(Object[]) Method

wpf-devexpress-dot-xpf-dot-pivotgrid-dot-pivotgridcontrol-dot-getrowindex-x28-system-dot-object-x29.md

latest3.7 KB
Original Source

PivotGridControl.GetRowIndex(Object[]) Method

Returns the index of the specified row.

Namespace : DevExpress.Xpf.PivotGrid

Assembly : DevExpress.Xpf.PivotGrid.v25.2.dll

NuGet Package : DevExpress.Wpf.PivotGrid

Declaration

csharp
public int GetRowIndex(
    params object[] values
)
vb
Public Function GetRowIndex(
    ParamArray values As Object()
) As Integer

Parameters

NameTypeDescription
valuesObject[]

An array of row field values that identify the row.

|

Returns

TypeDescription
Int32

An integer value that specifies the row index. -1 if the specified row has not been not found.

|

Remarks

Pivot Grid columns and rows are indexed as shown below:

If the specified field value array identifies several rows, the GetRowIndex method returns the smallest index.

The following table demonstrates how to use the GetRowIndex method to obtain row indexes.

Method UsageReturn Value
pivotGridControl.GetRowIndex("UK")0
pivotGridControl.GetRowIndex("UK","Anne Dodsworth")1
pivotGridControl.GetRowIndex("UK","Michael Suyama")2

To obtain the index of a particular column, use the PivotGridControl.GetColumnIndex method.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetRowIndex(Object[]) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

wpf-pivot-grid-add-custom-field-values-rows-columns-not-present-in-datasource/CS/WpfApplication1/MainWindow.xaml.cs#L62

csharp
{
    int index = pivot.GetRowIndex(new object[] { null });
    if (index != -1)

wpf-pivot-grid-add-custom-field-values-rows-columns-not-present-in-datasource/VB/WpfApplication1/MainWindow.xaml.vb#L47

vb
Private Sub pivot_CustomFieldValueCells(ByVal sender As Object, ByVal e As DevExpress.Xpf.PivotGrid.PivotCustomFieldValueCellsEventArgs)
    Dim index As Integer = Me.pivot.GetRowIndex(New Object() {Nothing})
    If index <> -1 Then e.Remove(e.GetCell(False, index))

See Also

GetColumnIndex

PivotGridControl Class

PivotGridControl Members

DevExpress.Xpf.PivotGrid Namespace