Skip to main content
All docs
V24.1

VGridControl.RecordHeaderFormat Property

Gets or sets the format string used to generate header text for the control’s records.

Namespace: DevExpress.XtraVerticalGrid

Assembly: DevExpress.XtraVerticalGrid.v24.1.dll

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

Declaration

[DefaultValue("")]
[XtraSerializableProperty]
public string RecordHeaderFormat { get; set; }

Property Value

Type Default Description
String String.Empty

The record header format string.

Remarks

Set the OptionsView.ShowRecordHeaders property to true to enable record headers.

Vertical Grid - Record Headers

Run Demo: PC Market

You can specify record header content as follows:

The record format supports the following elements:

  • Static text.

  • The syntax to insert the display values of text fields:

    {FieldName[,alignment]}

    The optional alignment setting is a signed integer that specifies the preferred width of the resulting string. See the following link for more information: Alignment Component.

    Examples:

    • {ModelPrice} — Returns the display text of the ‘ModelPrice’ row (field).
    • {CategoryID, 10} — Returns the display text of the ‘CategoryID’ row (field) with a 10-character requirement. If the length of the field’s display text is less than 10 characters, the resulting string is padded with leading spaces to meet this requirement.
  • HTML-inspired formatting tags: b, i, size, href, image, br, and so on. Enable the OptionsView.AllowHtmlText setting to allow HTML tags.

    The br tag requires that you enable word wrap with the VGridControl.Appearance.RecordHeader.TextOptions.WordWrap setting.

    Do the following to allow users to click hyperlinks, and to respond to these actions:

Example

The following format string displays a hyperlink, and values of the ‘ProcName’ and ‘ModelPrice’ fields in record headers.

Vertical Grid - RecordHeaderFormat

vGridControl1.OptionsView.AllowHtmlText = true;
vGridControl1.Appearance.RecordHeader.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
vGridControl1.RecordHeaderFormat = "<br><size=10><b>{ProcName}</b><br><br>" +
    "<size=12>{ModelPrice}</size><br><br>" +
    "<size=7><b><href=shoppingcart>ADD TO CART</href><br><br>";

Example

In the following example, a Vertical Grid’s record headers contain hyperlinks that display employees’ e-mails. The VGridOptionsBehavior.HyperlinkClickMode property is set to CtrlClick to allow users to activate hyperlinks on a mouse click when the CTRL key is pressed down. The VGridControlBase.HyperlinkClick event handler starts a process that opens a clicked hyperlink.

Vertical Grid - Hyperlink Click

private void Form1_Load(object sender, EventArgs e) {
    BindingList<Message> list = new BindingList<Message>();
    list.Add(new Message() { Date = DateTime.Now, Email = "jheart@dx-email.com", From = "John Heart", PlainText = "Hello All   Please remember that I’ve rescheduled...", Subject = "DevAV Annual Performance Review" });
    list.Add(new Message() { Date = DateTime.Now, Email = "violetb@dx-email.com", From = "Violet Bailey", PlainText = "Good Day Morgan   I’ve been asked by the sales team...", Subject = "Artwork for packaging" });
    vGridControl1.DataSource = list;
    vGridControl1.OptionsView.ShowRecordHeaders = true;
    vGridControl1.OptionsView.AllowHtmlText = true;
    vGridControl1.RecordHeaderFormat = "<b>{From}</b><br><a href=mailto:{Email}>{Email}</a>";
    vGridControl1.Appearance.RecordHeader.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
    vGridControl1.RecordWidth = 150;
    vGridControl1.OptionsBehavior.HyperlinkClickMode = DevExpress.Utils.Drawing.HyperlinkClickMode.CtrlClick;
    vGridControl1.HyperlinkClick += VGridControl1_HyperlinkClick;
}

private void VGridControl1_HyperlinkClick(object sender, DevExpress.XtraVerticalGrid.Events.HyperlinkClickEventArgs e) {
    if (e.Link.StartsWith("mailto:"))
        System.Diagnostics.Process.Start(e.Link);
}

public class Message {
    public DateTime Date { get; set; }
    public string From { get; set; }
    public string Email { get; set; }
    public string Subject { get; set; }
    public string PlainText { get; set; }
}
See Also