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

PivotGridField(String, FieldArea) Constructor

Initializes a new instance of the PivotGridField class with the specified field name and location.

Namespace: DevExpress.Xpf.PivotGrid

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

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

Declaration

public PivotGridField(
    string fieldName,
    FieldArea area
)

Parameters

Name Type Description
fieldName String

A String identifying the name of the database field. This value is assigned to the PivotGridField.FieldName property.

area FieldArea

A FieldArea enumeration value that defines the location for the PivotGridField object within the control. This value is assigned to the PivotGridField.Area property.

Remarks

This constructor initializes the PivotGridField.FieldName and PivotGridField.Area properties with the specified values. All the other properties of the created PivotGridField object are set to default values.

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>
See Also