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

CardView.CardCaptionFormat Property

Gets or sets the card caption text pattern.

Namespace: DevExpress.XtraGrid.Views.Card

Assembly: DevExpress.XtraGrid.v19.1.dll

Declaration

[DefaultValue("")]
[XtraSerializableProperty]
[DXCategory("Appearance")]
public string CardCaptionFormat { get; set; }

Property Value

Type Default Description
String String.Empty

A string value specifying the card caption text pattern.

Remarks

The CardCaptionFormat property allows you to specify the pattern used to construct card caption text. In card captions, you can display any static text, the current record number and card field values (column values). The following placeholders are recognized in the card caption format:

  • {0} - This placeholder is substituted for the current record number.
  • {1}, {2}, {3}, etc. - These placeholders insert field (column) values. Value {1} refers to the very first column in the ColumnView.Columns collection (this column resides at index of 0 in this collection). Value {2} refers to the second column in this collection, etc.

    Using these placeholders, you can refer to both visible and hidden fields (see GridColumn.Visible).

    Note

    Only text field values can be inserted using these placeholders. To display images in card captions, handle the CardView.CustomCardCaptionImage event.

In the following example, a custom card caption format is specified to display the static text (“Record #”) followed by the current record number plus the second card field value:


cardView1.CardCaptionFormat = "Record # {0}, {2}";

CardCaptionFormat-ex

Note that the card captions in the image above display values (“Beverages”, “Condiments”, “Confections” and “Dairy Products”) from the second card field, which is hidden.

Field (column) values in card captions are formatted according to the GridColumn.DisplayFormat property.

To return the card caption text constructed based on the CardCaptionFormat pattern for an individual card, use the CardView.GetCardCaption method.

See Also