All docs
V21.1
21.2 (EAP/Beta)
21.1
20.2
The page you are viewing does not exist in version 20.2. This link will take you to the root page.
20.1
The page you are viewing does not exist in version 20.1. This link will take you to the root page.
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

TreeListView.CustomColumnDisplayTextCommand Property

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

Namespace: DevExpress.Xpf.Grid

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

Declaration

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

Property Value

Type Description
DevExpress.Mvvm.ICommand<NodeDisplayTextArgs>

Contains properties that identify the processed cell.

Remarks

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 both bound and unbound columns. The printed GridControl displays customized text as well.

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

<dxg:GridControl ItemsSource="{Binding Source}"
                 CustomColumnDisplayTextCommand="{Binding CustomColumnDisplayTextCommand}">
    <dxg:GridControl.View>
        <dxg:TreeListView />
    </dxg:GridControl.View>
    <dxg:TreeListColumn FieldName="ProductName" IsSmart="True"/>
    <dxg:TreeListColumn FieldName="Country" IsSmart="True"/>
    <dxg:TreeListColumn FieldName="City" IsSmart="True"/>
    <dxg:TreeListColumn FieldName="Value" IsSmart="True"/>
</dxg:GridControl>
using DevExpress.Mvvm;
using DevExpress.Mvvm.DataAnnotations;
using DevExpress.Mvvm.Xpf;

public class ViewModel : ViewModelBase {
    // ...

    [Command]
    public void CustomColumnDisplayText(NodeDisplayTextArgs e) {
        if (e.FieldName == "Value")
            e.DisplayText = string.Format("{0:n2}", e.Value);
    }
}
See Also