Skip to main content
A newer version of this page is available. .
Tag

PivotGridField.AreaIndex Property

Gets or sets the field’s index among the other fields displayed within the same area. This is a dependency property.

Namespace: DevExpress.Xpf.PivotGrid

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

NuGet Packages: DevExpress.WindowsDesktop.Wpf.PivotGrid, DevExpress.Wpf.PivotGrid

Declaration

public int AreaIndex { get; set; }

Property Value

Type Description
Int32

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

Remarks

A 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.

If the current field is hidden, assigning a positive value to the AreaIndex property makes the field visible. If the field is visible, assigning a negative value to this property will hide the field and will set its AreaIndex property to -1.

Use the PivotGridField.Area property to specify the area in which the field is displayed. The field’s position can also be set via the PivotGridField.SetAreaPosition method.

Dragging a field from one area to another automatically changes the AreaIndex property’s value, and vice versa. Before the field’s location is changed, the DXPivotGrid fires the PivotGridControl.FieldAreaChanging event, allowing you to cancel the action. After the location has been changed, the PivotGridControl.FieldAreaChanged event is fired.

Multiple fields can be combined into a group via 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 PivotGridField.Area and AreaIndex properties of the first field in the group. Modifying the PivotGridField.Area and AreaIndex properties for the second and subsequent fields in the group is ignored.

Example

The following example demonstrates how to programmatically bind the PivotGridControl to a “SalesPerson” view in the nwind.mdb database, which is shipped with the installation. The control will be used to analyse sales per country, customers, product categories and years.

First, data is obtained from an MDB database via the OleDbConnection, OleDbDataAdapter and DataSet components. Secondly, the PivotGridControl is bound to a table in the dataset via the PivotGridControl.DataSource property. Lastly, pivot grid fields are created that will represent datasource fields. They are positioned within appropriate areas to analyze the data in the way you want.

Note that if you want to see an example of how to add pivot grid fields in XAML, please refer to the How to: Bind a PivotGrid to an MS Access Database tutorial.

View Example

<Window x:Class="HowToBindToMDB.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:dxpg="http://schemas.devexpress.com/winfx/2008/xaml/pivotgrid"
        Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded">
    <Grid>
        <dxpg:PivotGridControl Name="pivotGridControl1" 
                               HorizontalAlignment="Left" VerticalAlignment="Top" />
    </Grid>
</Window>

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.

See Also