Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

VGridControl.CustomRecordHeaderDisplayText Event

Allows you to assign text to individual record headers.

Namespace: DevExpress.XtraVerticalGrid

Assembly: DevExpress.XtraVerticalGrid.v24.2.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