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

PivotGridFieldCollection.Item[String] Property

Gets the field with the specified name.

Namespace: DevExpress.Xpf.PivotGrid

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

Declaration

public PivotGridField this[string fieldName] { get; }

Parameters

Name Type Description
fieldName String

A string value specifying the bound field name of the required PivotGridField object.

Property Value

Type Description
PivotGridField

The PivotGridField object representing the field with the specified name; null (Nothing in Visual Basic) if the field does not exist.

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.

<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