corelibraries-devexpress-dot-xtrapivotgrid-dot-pivotgridfieldbase-f17d2fdb.md
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
[DefaultValue("")]
public string Caption { get; set; }
<DefaultValue("")>
Public Property Caption As String
| Type | Default | Description |
|---|---|---|
| String | String.Empty |
A string specifying the field’s display caption.
|
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.
fieldYear.Name = "FieldYear";
fieldYear.Caption = fieldYear.Name;
PivotGridField fieldMonth = new PivotGridField();
winforms-pivot-change-summarydisplaytype-in-context-menu/CS/WindowsApplication34/Form1.cs#L26
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
pivotGridFieldGroups.Area = PivotArea.RowArea;
pivotGridFieldGroups.Caption = "Product Groups";
pivotGridFieldGroups.Options.ShowExpressionEditorMenu = true;
winforms-pivot-grid-display-kpi-graphics/CS/WindowsFormsApp_RegularDataSourceKPI/Form1.cs#L16
KPIField.Area = PivotArea.DataArea;
KPIField.Caption = "Status";
// Sets a column's data binding and specifies an expression.
if (field != null && field.Caption == "Percents") {
int value = Convert.ToInt32(Convert.ToDecimal(
fieldYear.Name = "FieldYear"
fieldYear.Caption = fieldYear.Name
Dim fieldMonth As New PivotGridField()
winforms-pivot-change-summarydisplaytype-in-context-menu/VB/WindowsApplication34/Form1.vb#L28
fieldYear.Name = "FieldYear"
fieldYear.Caption = fieldYear.Name
fieldYear.GroupInterval = PivotGroupInterval.DateYear
winforms-pivot-grid-custom-group-intervals/VB/CustomGroupIntervals/Form1.vb#L30
pivotGridFieldGroups.Area = PivotArea.RowArea
pivotGridFieldGroups.Caption = "Product Groups"
pivotGridFieldGroups.Options.ShowExpressionEditorMenu = True
winforms-pivot-grid-display-kpi-graphics/VB/WindowsFormsApp_RegularDataSourceKPI/Form1.vb#L20
KPIField.Area = PivotArea.DataArea
KPIField.Caption = "Status"
' Sets a column's data binding and specifies an expression.
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