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.NodeContentTemplateSelector Property

Gets or sets an object that chooses a node content template based on custom logic. This is a dependency property.

Namespace: DevExpress.Xpf.Grid

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

NuGet Package: DevExpress.Wpf.Grid.Core

#Declaration

public DataTemplateSelector NodeContentTemplateSelector { get; set; }

#Property Value

Type Description
DataTemplateSelector

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

#Remarks

The NodeContentTemplate property specifies a template that displays a node’s content. If you have more than one node content template, you can implement custom logic to choose the required template:

  1. Create a template selector - a class that chooses a template based on a 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 template selector class instance to the NodeContentTemplateSelector property.

If you specify both the NodeContentTemplate and NodeContentTemplateSelector, the TreeViewControl uses the template returned by the template selector.

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

See Also