Skip to main content
All docs
V24.1

VGridControl.CustomRecordHeaderDisplayText Event

Allows you to assign text to individual record headers.

Namespace: DevExpress.XtraVerticalGrid

Assembly: DevExpress.XtraVerticalGrid.v24.1.dll

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

Declaration

[DXCategory("Appearance")]
public event CustomRecordHeaderDisplayTextEventHandler CustomRecordHeaderDisplayText

Event Data

The CustomRecordHeaderDisplayText event's data class is DevExpress.XtraVerticalGrid.Events.CustomRecordHeaderDisplayTextEventArgs.

Remarks

Enable the VGridOptionsView.ShowRecordHeaders property to display record headers.

You can specify record header content as follows:

Example

The following example handles the VGridControl.CustomRecordHeaderDisplayText event to assign different text to different record headers. Headers of records that correspond to out-of-stock products display the “Out of stock” string. Other headers display a product’s brand and model information formatted with HTML tags.

VerticalGrid - CustomRecordHeaderDisplayText

vGridControl.OptionsView.ShowRecordHeaders = true;
vGridControl.OptionsView.AllowHtmlText = true;
vGridControl.Appearance.RecordHeader.TextOptions.WordWrap = WordWrap.Wrap;
//...
private void vGridControl_CustomRecordHeaderDisplayText(object sender, Events.CustomRecordHeaderDisplayTextEventArgs e) {
    VGridControl vGrid = sender as VGridControl;
    bool inStock = (bool)vGrid.GetCellValue("InStock", e.Record);
    if (inStock) {
        string maker = (string)vGrid.GetCellDisplayText(erTrademark.Properties, e.Record);
        string model = (string)vGrid.GetCellDisplayText(erName.Properties, e.Record);
        e.DisplayText = $"<size=+1>{maker}<br><size=+2><color=green><b>{model}</b>";
    }
    else
        e.DisplayText = "<color=gray>Out of stock</color>";
}
See Also