GridControl.CustomColumnDisplayText Event
In This Article
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. |
Display |
Gets or sets the text displayed in the processed cell. |
List |
Gets the row’s index in a data source. |
Row | Gets the processed row. |
Row |
Gets the processed row’s handle. |
Source |
Gets the Grid |
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:
<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