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
[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.
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 the 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";
}
}
}