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

DxPivotGridField.Field Property

Specifies the name of the database field that is assigned to the current object.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v22.1.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public string Field { get; set; }

Property Value

Type Description
String

A String value that is the name of the data field.

Remarks

Use the following syntax to connect a Pivot Grid field with a data source field:

<DxPivotGrid Data="@PivotGridData">
    <DxPivotGridField Field="@nameof(SaleInfo.City)" Area="PivotGridFieldArea.Row"></DxPivotGridField>
    <DxPivotGridField Field="@nameof(SaleInfo.Date)" GroupInterval="PivotGridGroupInterval.Year" Area="PivotGridFieldArea.Column" Caption="Year"></DxPivotGridField>
    <DxPivotGridField Field="@nameof(SaleInfo.Amount)" Area="PivotGridFieldArea.Data" SummaryType="PivotGridSummaryType.Sum"></DxPivotGridField>
</DxPivotGrid>

You can also bind a Pivot Grid column to a complex field (a field that belongs to a data source object’s nested object). A complex field name is constructed via the DataSourceObject.Name1.Name2 structure. To bind a column to a complex field (CompanyName in the example below), use the following approach:

@{ var CompanyName = $"{nameof(Order.CompanyInfo)}.{nameof(Company.Name)}"; }

<DxPivotGrid Data="@Orders">
    <DxPivotGridField Field="@nameof(Order.ProductName)" Area="PivotGridFieldArea.Row"></DxPivotGridField>
    <DxPivotGridField Field="@CompanyName" Area="PivotGridFieldArea.Column"></DxPivotGridField>
    ...
</DxPivotGrid>

@code {

    IEnumerable<Order> Orders;

    public class Order {
        public int ID { get; set; }
        public string ProductName { get; set; }
        public Company CompanyInfo { get; set; } = new Company();
    }

    public class Company {
        public string Name { get; set; }
        public string Address { get; set; }
    }
}
See Also