Back to Devexpress

LayoutView.CardCaptionFormat Property

windowsforms-devexpress-dot-xtragrid-dot-views-dot-layout-dot-layoutview-b9d9eb65.md

latest4.4 KB
Original Source

LayoutView.CardCaptionFormat Property

Gets or sets the format string for text in card captions.

Namespace : DevExpress.XtraGrid.Views.Layout

Assembly : DevExpress.XtraGrid.v25.2.dll

NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation

Declaration

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

Property Value

TypeDefaultDescription
StringString.Empty

A string that specifies the card caption text pattern.

|

Remarks

The CardCaptionFormat property allows you to specify the pattern used to construct text in card captions. You can display static text, the current record number, the total record count, and card field display values. Use the following placeholders to construct the card caption format:

  • {0} — Inserts the current record number.

  • {1} — Inserts the total record count (LayoutView.RecordCount).

  • {FieldName[, alignment]} — Inserts the specified field’s display text. The optional alignment setting is a signed integer that specifies the preferred width of the resulting string.

  • {2[, alignment]}, {3[, alignment]}, {4[, alignment]}, etc. — Insert display text of fields referred to by their 2-based indexes in the LayoutView.Columns collection.

In the following example, the card caption format displays a record index, the total record number, and the display value of the ‘CategoryName’ field:

csharp
layoutView1.CardCaptionFormat = "Record {0} of {1} - {CategoryName}";
vb
LayoutView1.CardCaptionFormat = "Record {0} of {1} - {CategoryName}"

The placeholders allow you to insert only text field values. Handle the LayoutView.CustomCardCaptionImage event to display images in card captions.

A field’s DisplayFormat property and ColumnView.CustomColumnDisplayText event allow you to specify field display text in card captions.

Use the LayoutView.GetCardCaption method to return the card caption text constructed based on the CardCaptionFormat pattern.

See Also

FieldCaptionFormat

GetCardCaption(Int32)

DisplayFormat

CustomColumnDisplayText

ShowCardCaption

Format Cell Values

LayoutView Class

LayoutView Members

DevExpress.XtraGrid.Views.Layout Namespace