Back to Devexpress

PivotGridFieldBase.AreaIndex Property

corelibraries-devexpress-dot-xtrapivotgrid-dot-pivotgridfieldbase-6fa1d794.md

latest8.3 KB
Original Source

PivotGridFieldBase.AreaIndex Property

Gets or sets the field’s index from among the other fields displayed within the same area.

Namespace : DevExpress.XtraPivotGrid

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

NuGet Packages : DevExpress.PivotGrid.Core, DevExpress.Win.Navigation

Declaration

csharp
[DefaultValue(-1)]
public virtual int AreaIndex { get; set; }
vb
<DefaultValue(-1)>
Public Overridable Property AreaIndex As Integer

Property Value

TypeDefaultDescription
Int32-1

A zero-based integer that specifies the field’s index among the other fields displayed within the same area.

|

Remarks

Each field can be placed within one of four areas: Filter Header Area, Column Header Area, Row Header Area or Data Header Area. The AreaIndex property specifies the field’s index among the other fields displayed within the same area, and so specifies the field’s visual position. You can use the AllowedAreas property to specify the areas within which the field can be positioned.

When you assign a positive value to the AreaIndex property, you make the current field visible in case it was hidden. Similarly, if the field is visible, a negative value hides the field. In this case, its AreaIndex property value is changed to -1.

Use the Area property to specify the area in which the field is displayed.

Multiple fields can be combined into a group with the PivotGridControl.Groups property. These fields cannot be separated and are always dragged together. To move a group to a specific area or to a new position within the current area use the PivotGridFieldBase.Area and AreaIndex properties of the first field in the group. Modifying the Area and AreaIndex properties for the second and subsequent fields in the group is ignored.

The following code snippets (auto-collected from DevExpress Examples) contain references to the AreaIndex property.

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.

winforms-pivotgrid--display-the-difference-of-income-and-outlay-in-totals/CS/PivotGridCustomSummaryExample/CustomSummaryHelper.cs#L26

csharp
if (groupField.Area == PivotArea.RowArea &&
    (e.RowField == null || e.RowField.AreaIndex < groupField.AreaIndex))
    return true;

winforms-pivot-grid-provide-custom-summary-values-for-cells/CS/WinPivotCustomSummaryCellType/Form1.cs#L27

csharp
// This is an ordinary cell.
if (e.RowField.AreaIndex == lastRowFieldIndex && e.ColumnField.AreaIndex == lastColumnFieldIndex) {
    e.CustomValue = e.SummaryValue.Average;

winforms-pivot-grid-hide-specific-columns-and-rows/CS/Data.cs#L23

csharp
pivot.Fields.AddDataSourceColumn(Widget, PivotArea.RowArea);
pivot.Fields.AddDataSourceColumn(Month, PivotArea.ColumnArea).AreaIndex = 0;
pivot.Fields.AddDataSourceColumn(RetailPrice, PivotArea.DataArea);

winforms-pivot-split-field-value-cells/CS/Data.cs#L23

csharp
pivot.Fields.AddDataSourceColumn(Widget, PivotArea.RowArea);
pivot.Fields.AddDataSourceColumn(Month, PivotArea.ColumnArea).AreaIndex = 0;
pivot.Fields.AddDataSourceColumn(RetailPrice, PivotArea.DataArea);

winforms-pivot-totals-visibility/CS/Form1.cs#L31

csharp
if(pivotGridControl.Fields[i].Visible && pivotGridControl.Fields[i].Area == field.Area
    && pivotGridControl.Fields[i].AreaIndex > field.AreaIndex)
    return false;

winforms-pivotgrid--display-the-difference-of-income-and-outlay-in-totals/VB/PivotGridCustomSummaryExample/CustomSummaryHelper.vb#L26

vb
End If
If groupField.Area = PivotArea.RowArea AndAlso (e.RowField Is Nothing OrElse e.RowField.AreaIndex < groupField.AreaIndex) Then
    Return True

winforms-pivot-grid-provide-custom-summary-values-for-cells/VB/VBWinPivotCustomSummaryCellType/Form1.vb#L27

vb
' This is an ordinary cell.
If e.RowField.AreaIndex = lastRowFieldIndex AndAlso e.ColumnField.AreaIndex = lastColumnFieldIndex Then
    e.CustomValue = e.SummaryValue.Average

winforms-pivot-grid-hide-specific-columns-and-rows/VB/Data.vb#L27

vb
pivot.Fields.AddDataSourceColumn(Widget, PivotArea.RowArea)
pivot.Fields.AddDataSourceColumn(Month, PivotArea.ColumnArea).AreaIndex = 0
pivot.Fields.AddDataSourceColumn(RetailPrice, PivotArea.DataArea)

winforms-pivot-split-field-value-cells/VB/Data.vb#L27

vb
pivot.Fields.Add(Widget, PivotArea.RowArea)
pivot.Fields.Add(Month, PivotArea.ColumnArea).AreaIndex = 0
pivot.Fields.Add(RetailPrice, PivotArea.DataArea)

winforms-pivot-totals-visibility/VB/Form1.vb#L34

vb
For i As Integer = 0 To pivotGridControl.Fields.Count - 1
    If pivotGridControl.Fields(i).Visible AndAlso pivotGridControl.Fields(i).Area = field.Area AndAlso pivotGridControl.Fields(i).AreaIndex > field.AreaIndex Then
        Return False

See Also

AllowedAreas

Area

SetAreaPosition(PivotArea, Int32)

PivotGridFieldBase Class

PivotGridFieldBase Members

DevExpress.XtraPivotGrid Namespace