TreeListView.CustomColumnDisplayText Event
Allows you to customize a data cell‘s display text.
Namespace: DevExpress.Xpf.Grid
Assembly: DevExpress.Xpf.Grid.v24.2.dll
NuGet Package: DevExpress.Wpf.Grid.Core
Declaration
Event Data
The CustomColumnDisplayText event's data class is TreeListCustomColumnDisplayTextEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Column | Gets the column which owns the processed cell. |
DisplayText | Gets or sets the display text for the cell currently being processed. |
Node | Gets the node which owns the processed cell. |
ShowAsNullText | Specifies whether text corresponding to a null value appears faded. |
Value | Gets the processed cell’s value. |
Remarks
The CustomColumnDisplayText event occurs for bound and unbound columns. The printed GridControl also displays customized text.
If you want to maintain a clean MVVM pattern and customize a data cell’s display text in a View Model, create a command and bind it to the CustomColumnDisplayTextCommand property.
The TreeListCustomColumnDisplayTextEventArgs.DisplayText property contains a cell’s display text. To customize the display text, assign a string value to this property.
<dxg:TreeListColumn FieldName="Value"/>
void treeList_CustomColumnDisplayText(object sender, TreeListCustomColumnDisplayTextEventArgs e) {
if (e.Column.FieldName == "Value")
e.DisplayText = string.Format("{0:n2}", e.Value);
}
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the CustomColumnDisplayText event.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.