Skip to main content
All docs

GridControl.CustomColumnDisplayTextCommand Property

Gets or sets a command that customizes a data cell‘s display text.

Namespace: DevExpress.Xpf.Grid

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


public ICommand<ColumnDisplayTextArgs> CustomColumnDisplayTextCommand { get; set; }

Property Value

Type Description

Contains properties that identify the processed cell.


Bind a command to the CustomColumnDisplayTextCommand property to maintain a clean MVVM pattern. The command works like a CustomColumnDisplayText event handler and allows you to customize a data cell’s display text in a View Model.

The command is called for bound and unbound columns. The printed GridControl also displays customized text.

The DisplayTextArgs.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 SourceIndex property returns an invalid value. 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.


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 ItemsSource="{Binding InvoiceList}" 
                 CustomColumnDisplayTextCommand="{Binding CustomColumnDisplayTextCommand}"/>
using DevExpress.Mvvm;
using DevExpress.Mvvm.DataAnnotations;
using DevExpress.Mvvm.Xpf;
// ...
public class MainViewModel : ViewModelBase {
// ...
    public void CustomColumnDisplayText(ColumnDisplayTextArgs args) {
        if(args.FieldName != nameof(Invoice.ProductName)) {
        if(InvoiceList[args.SourceIndex].Discount > 20) {
            args.DisplayText += " (SALE)";
See Also