Skip to main content

GridControl.CustomColumnDisplayText Event

Allows you to customize a data cell‘s display text.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v22.2.dll

NuGet Package: DevExpress.Wpf.Grid.Core


public event CustomColumnDisplayTextEventHandler CustomColumnDisplayText

Event Data

The CustomColumnDisplayText event's data class is CustomColumnDisplayTextEventArgs. The following properties provide information specific to this event:

Property Description
Column Gets the column which owns the processed cell.
DisplayText Gets or sets the display text for the cell currently being processed.
ListSourceIndex Gets the index of a record in a data source that corresponds to the processed data row.
Row Gets the row which owns the processed cell.
RowHandle Gets the processed row’s handle.
ShowAsNullText Specifies whether text corresponding to a null value appears faded.
Source Gets the grid control that raised the event.
Value Gets the processed cell’s value.


The CustomColumnDisplayText event occurs for bound and unbound columns. The printed GridControl also displays customized text.

The CustomColumnDisplayTextEventArgs.DisplayText property contains a cell’s display text. To customize the display text, assign a string value to this property.

If column data is sorted or grouped, the event’s RowHandle and ListSourceRowIndex properties return invalid values. As a result, you cannot determine the processed row and obtain other cell values. To customize the display text, use techniques described in the following topic instead: Format Cell Values.

If you want to maintain a clean MVVM pattern and customize a data cell’s display text in a View Model, create a command and bind it to the CustomColumnDisplayTextCommand property.


The following example shows how to display custom text in data cells. In this example, the GridControl adds the (SALE) string to the Product Name if a value in the Discount column is greater than 20:

DevExpress WPF | Grid Control - Custom Display Text

View Example: How to display custom text within data cells

<dxg:GridControl CustomColumnDisplayText="gridControl1_CustomColumnDisplayText" Name="gridControl1">
        <dxg:GridColumn x:Name="columnProductName" FieldName="ProductName" />
        <dxg:GridColumn FieldName="Price" />
        <dxg:GridColumn FieldName="Discount" />
void gridControl1_CustomColumnDisplayText(object sender, CustomColumnDisplayTextEventArgs e) {
    if((double)gridControl1.GetCellValue(e.RowHandle, "Discount") > 20)
        e.DisplayText = ((string)e.Value) + " (SALE)";

The following code snippets (auto-collected from DevExpress Examples) contain references to the CustomColumnDisplayText event.


The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also