Back to Devexpress

PivotGridFieldBase.Caption Property

corelibraries-devexpress-dot-xtrapivotgrid-dot-pivotgridfieldbase-f17d2fdb.md

latest7.5 KB
Original Source

PivotGridFieldBase.Caption Property

Gets or sets the field’s display caption.

Namespace : DevExpress.XtraPivotGrid

Assembly : DevExpress.PivotGrid.v25.2.Core.dll

NuGet Packages : DevExpress.PivotGrid.Core, DevExpress.Win.Navigation

Declaration

csharp
[DefaultValue("")]
public string Caption { get; set; }
vb
<DefaultValue("")>
Public Property Caption As String

Property Value

TypeDefaultDescription
StringString.Empty

A string specifying the field’s display caption.

|

Remarks

Use the Caption property to specify the text displayed within the field’s header.

If the Caption property is set to an empty string the field’s header will display the value of the PivotGridFieldBase.FieldName property. If the PivotGridFieldBase.FieldName property is set to an empty string, the field’s header will display the value of the field’s Name property.

If the PivotGridFieldOptions.ShowSummaryTypeName property is enabled, the field’s summary type enclosed in round brackets is appended to the field’s Caption. To get the actual text displayed within a field’s header, use the PivotGridFieldBase.HeaderDisplayText property.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Caption 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.

winforms-pivot-grid-hide-the-grand-total-column-and-text-labels/CS/RemoveGridLinesExample/Form1.cs#L35

csharp
fieldYear.Name = "FieldYear";
fieldYear.Caption = fieldYear.Name;
PivotGridField fieldMonth = new PivotGridField();

winforms-pivot-change-summarydisplaytype-in-context-menu/CS/WindowsApplication34/Form1.cs#L26

csharp
fieldYear.DataBinding = new DataSourceColumnBinding("Date", PivotGroupInterval.DateYear);
fieldYear.Caption = fieldYear.Name;
pivotGridControl1.Fields.AddRange(new PivotGridField[] { fieldYear });

winforms-pivot-grid-custom-group-intervals/CS/CustomGroupIntervals/Form1.cs#L31

csharp
pivotGridFieldGroups.Area = PivotArea.RowArea;
pivotGridFieldGroups.Caption = "Product Groups";
pivotGridFieldGroups.Options.ShowExpressionEditorMenu = true;

winforms-pivot-grid-display-kpi-graphics/CS/WindowsFormsApp_RegularDataSourceKPI/Form1.cs#L16

csharp
KPIField.Area = PivotArea.DataArea;
KPIField.Caption = "Status";
// Sets a column's data binding and specifies an expression.

web-forms-pivot-grid-customize-cell-appearance-via-templates/CS/ASPxPivotGrid_CellTemplates/Default.aspx.cs#L19

csharp
if (field != null && field.Caption == "Percents") {
    int value = Convert.ToInt32(Convert.ToDecimal(

winforms-pivot-grid-hide-the-grand-total-column-and-text-labels/VB/RemoveGridLinesExample/Form1.vb#L41

vb
fieldYear.Name = "FieldYear"
fieldYear.Caption = fieldYear.Name
Dim fieldMonth As New PivotGridField()

winforms-pivot-change-summarydisplaytype-in-context-menu/VB/WindowsApplication34/Form1.vb#L28

vb
fieldYear.Name = "FieldYear"
fieldYear.Caption = fieldYear.Name
fieldYear.GroupInterval = PivotGroupInterval.DateYear

winforms-pivot-grid-custom-group-intervals/VB/CustomGroupIntervals/Form1.vb#L30

vb
pivotGridFieldGroups.Area = PivotArea.RowArea
pivotGridFieldGroups.Caption = "Product Groups"
pivotGridFieldGroups.Options.ShowExpressionEditorMenu = True

winforms-pivot-grid-display-kpi-graphics/VB/WindowsFormsApp_RegularDataSourceKPI/Form1.vb#L20

vb
KPIField.Area = PivotArea.DataArea
KPIField.Caption = "Status"
' Sets a column's data binding and specifies an expression.

web-forms-pivot-grid-customize-cell-appearance-via-templates/VB/ASPxPivotGrid_CellTemplates/Default.aspx.vb#L23

vb
Dim field As PivotGridField = templateContainer.DataField
If field IsNot Nothing AndAlso Equals(field.Caption, "Percents") Then
    Dim value As Integer = Convert.ToInt32(Convert.ToDecimal(templateContainer.Value) * 350)

See Also

FieldName

ShowSummaryTypeName

HeaderDisplayText

PivotGridFieldBase Class

PivotGridFieldBase Members

DevExpress.XtraPivotGrid Namespace