Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DxTreeList.CustomizeCellDisplayText Event

Allows you to customize text displayed within a cell.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[Parameter]
public Action<TreeListCustomizeCellDisplayTextEventArgs> CustomizeCellDisplayText { get; set; }

#Parameters

Type Description
TreeListCustomizeCellDisplayTextEventArgs

An object that contains data for this event.

#Remarks

You can handle the CustomizeCellDisplayText event or use a column’s DisplayFormat property to customize a cell’s display text. On export, the event handler logic applies only if the ExportDisplayText option is enabled.

Use TreeListCustomizeCellDisplayTextEventArgs (Value, FieldName, etc.) to specify the display format and access other TreeList data.

Note that if you implement DataColumnCellDisplayTemplate or CellDisplayTemplate, the CustomizeCellDisplayText event fires only if the template contains DisplayText.

The following example displays Completed text strings instead of 100 values in the Progress column:

@inject EmployeeTaskService TaskService

<DxTreeList Data="@Data"
            KeyFieldName="Id"
            ParentKeyFieldName="ParentId"
            CustomizeCellDisplayText="TreeList_CustomizeCellDisplayText" >
    <Columns>
        <DxTreeListDataColumn FieldName="Name" Caption="Task" Width="40%" />
        <DxTreeListDataColumn FieldName="EmployeeName" />
        <DxTreeListDataColumn FieldName="StartDate" />
        <DxTreeListDataColumn FieldName="DueDate" />
        <DxTreeListDataColumn FieldName="Progress" DisplayFormat="{0}%" />
    </Columns>
</DxTreeList>

@code {
    List<EmployeeTask> Data { get; set; }

    protected override void OnInitialized() {
        Data = TaskService.GenerateData();
    }
    void TreeList_CustomizeCellDisplayText(TreeListCustomizeCellDisplayTextEventArgs e) {
        if (e.FieldName == "Progress" && (int) e.Value == 100) {
            e.DisplayText = "Completed";
        }
    }
}

Customize Cell Display Text

See Also