Skip to main content
All docs
V24.1

TreeListView.CustomColumnDisplayTextCommand Property

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

Namespace: DevExpress.Xpf.Grid

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

NuGet Package: DevExpress.Wpf.Grid.Core

Declaration

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

Property Value

Type Description
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 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.

<dxg:GridControl ItemsSource="{Binding Source}">
    <dxg:GridControl.View>
        <dxg:TreeListView CustomColumnDisplayTextCommand="{Binding CustomColumnDisplayTextCommand}"/>
    </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