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

TreeViewControl.NodeTemplate Property

Gets or sets the template that defines the node appearance. This is a dependency property.

Namespace: DevExpress.Xpf.Grid

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

NuGet Package: DevExpress.Wpf.Grid.Core

#Declaration

public DataTemplate NodeTemplate { get; set; }

#Property Value

Type Description
DataTemplate

The template that defines node appearance. The template’s data context is a TreeViewRowData object.

#Remarks

The NodeTemplate property allows you to specify a template that changes the default appearance of data nodes. You can use the TreeListRowData object to get information about a node.

Note

Use the TreeViewControl.NodeContentTemplate property to specify a template that defines the appearance of node content.

If you have multiple node templates, use the TreeViewControl.NodeTemplateSelector property to implement custom logic to choose the required template.

If you specify both the NodeTemplate and TreeViewControl.NodeTemplateSelector, the TreeViewControl uses the template returned by the template selector.

If the template selector returns null, the TreeViewControl uses the template specified through the NodeTemplate property.

The following example changes the default appearance of data nodes:

<dxg:TreeViewControl ItemsSource="{Binding TreeNodes}">
    <dxg:TreeViewControl.NodeTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding Row.Content}" FontWeight="Bold"/>
        </DataTemplate>
    </dxg:TreeViewControl.NodeTemplate>
</dxg:TreeViewControl>
See Also