windowsforms-devexpress-dot-xtraverticalgrid-dot-vgridcontrol-fb6f358e.md
Allows you to assign text to individual record headers.
Namespace : DevExpress.XtraVerticalGrid
Assembly : DevExpress.XtraVerticalGrid.v25.2.dll
NuGet Packages : DevExpress.Win.Navigation, DevExpress.Win.VerticalGrid
[DXCategory("Appearance")]
public event CustomRecordHeaderDisplayTextEventHandler CustomRecordHeaderDisplayText
<DXCategory("Appearance")>
Public Event CustomRecordHeaderDisplayText As CustomRecordHeaderDisplayTextEventHandler
The CustomRecordHeaderDisplayText event's data class is DevExpress.XtraVerticalGrid.Events.CustomRecordHeaderDisplayTextEventArgs.
Enable the VGridOptionsView.ShowRecordHeaders property to display record headers.
You can specify record header content as follows:
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.
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}
<size=+2><color=green><b>{model}</b>";
}
else
e.DisplayText = "<color=gray>Out of stock</color>";
}
vGridControl.OptionsView.ShowRecordHeaders = True
vGridControl.OptionsView.AllowHtmlText = True
vGridControl.Appearance.RecordHeader.TextOptions.WordWrap = WordWrap.Wrap
'...
Private Sub VGridControl1_CustomRecordDisplayText(sender As Object, e As Events.CustomRecordDisplayTextEventArgs) Handles VGridControl1.CustomRecordDisplayText
Dim vGrid As VGridControl = TryCast(sender, VGridControl)
Dim inStock As Boolean = CBool(vGrid.GetCellValue("InStock", e.Record))
If inStock Then
Dim maker As String = CStr(vGrid.GetCellDisplayText(erTrademark.Properties, e.Record))
Dim model As String = CStr(vGrid.GetCellDisplayText(erName.Properties, e.Record))
e.DisplayText = $"<size=+1>{maker}
<size=+2><color=green><b>{model}</b>"
Else
e.DisplayText = "<color=gray>Out of stock</color>"
End If
End Sub
See Also