Skip to main content
All docs
V25.1
  • 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.v25.1.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