Skip to main content

GridControl.CustomColumnDisplayText Event

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

Namespace: DevExpress.WinUI.Grid

Assembly: DevExpress.WinUI.Grid.v23.2.dll

NuGet Package: DevExpress.WinUI

#Declaration

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 grid column.
DisplayText Gets or sets the text displayed in the processed cell.
ListSourceIndex Gets the row’s index in a data source.
Row Gets the processed row.
RowHandle Gets the processed row’s handle.
Source Gets the GridControl that raised this event.
Value Gets the processed cell’s value.

#Remarks

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

Grid - Custom Column Display Text

<dxg:GridControl ItemsSource="{x:Bind ViewModel.Source}"  
                 AutoGenerateColumns="False"
                 CustomColumnDisplayText="grid_CustomColumnDisplayText"/>
void grid_CustomColumnDisplayText(object sender, CustomColumnDisplayTextEventArgs e) {
    if (e.Column.FieldName == nameof(Product.ProductName)) {
        if (((Product)e.Row).Discount >= 20)
            e.DisplayText = e.Value.ToString() + " (SALE)";
    }
}
See Also