DxTreeViewBase.NodeTextTemplate Property

Specifies the common template to display all nodes' text.

Namespace: DevExpress.Blazor.Base

Assembly: DevExpress.Blazor.dll

Declaration

[Parameter]
public RenderFragment<ITreeViewNodeInfo> NodeTextTemplate { get; set; }

Property Value

Type Description
RenderFragment<ITreeViewNodeInfo>

The template content for an object of the ITreeViewNodeInfo type that provides information about a node (the text, level, bound data item, etc.)

Remarks

Use the NodeTextTemplate property to specify a template for the text of all TreeView nodes.

The following example demonstrates how to change the text settings for the root node and specify the multi-line text for other nodes.

<DxTreeView @ref="@treeView"
            Data="@ComponentsData.ComponentSets"             
            ChildrenExpression="@(dataItem => ((ComponentSet)dataItem).ComponentSets)">
    <NodeTextTemplate>
        @{
            var dataItem = (ComponentSet)context.DataItem;
        }
        @if (!context.IsLeaf)
        {
            <h5 class="mt-0  d-inline-block">@dataItem.Title</h5>
        }
        else
        {
            <div class="media-body">
                <h5 class="mt-0">@dataItem.Title</h5>
                @dataItem.Description
            </div>
        }
    </NodeTextTemplate>
</DxTreeView>

Blazor-TreeView-NodeTextTemplate

The NodeTemplate property allows you to modify the content for all nodes.

In unbound mode, you can also use the DxTreeViewNode.TextTemplate and DxTreeViewNode.Template properties to specify templates for individual nodes.

Online Demo

TreeView - Templates

See Also