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 |
---|---|
Data |
The template that defines node appearance. The template’s data context is a Tree |
#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 Tree
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>