PivotGridFieldCollection.Add(String, FieldArea) Method

Adds a new field with the specified field name and location to the end of the collection.

Namespace: DevExpress.Xpf.PivotGrid

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

Declaration

public PivotGridField Add(
    string fieldName,
    FieldArea area
)
Public Function Add(
    fieldName As String,
    area As FieldArea
) As PivotGridField

Parameters

Name Type Description
fieldName String

A string that identifies the name of the datasource field that will be assigned to the new PivotGridField object. This value is assigned to the PivotGridField.FieldName property.

area FieldArea

A FieldArea value that identifies the area in which the new field will be positioned. This value is assigned to the PivotGridField.Area property.

Returns

Type Description
PivotGridField

The PivotGridField object that has been added to the collection.

Examples

The following example demonstrates how to bind a PivotGridControl to an MS OLAP cube.

For this, it is required to set the PivotGridControl.OlapConnectionString property value, and add the necessary fields to the PivotGridControl.Fields collection.

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