Skip to main content
A newer version of this page is available. .
All docs
V20.2

TreeViewControl.NodeTemplateSelector Property

Gets or sets an object that chooses a template for data nodes based on custom logic. This is a dependency property.

Namespace: DevExpress.Xpf.Grid

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

NuGet Packages: DevExpress.WindowsDesktop.Wpf.Grid.Core, DevExpress.Wpf.Grid.Core

Declaration

public DataTemplateSelector NodeTemplateSelector { get; set; }

Property Value

Type Description
DataTemplateSelector

A DataTemplateSelector descendant that chooses a template based on custom logic.

Remarks

The TreeViewControl.NodeTemplate property specifies a template that defines the appearance of data nodes. If you have more than one node template, you can implement custom logic to choose the required template:

  1. Create a template selector - a class that chooses a template based on the condition. This class should derive from the DataTemplateSelector class.
  2. Override the SelectTemplate method to return a template that meets the required condition.
  3. Assign the instance of the template selector class to the NodeTemplateSelector property.

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

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

See Also