Back to Devexpress

TreeViewControl.ChildNodesSelector Property

wpf-devexpress-dot-xpf-dot-grid-dot-treeviewcontrol-b180df5e.md

latest2.6 KB
Original Source

TreeViewControl.ChildNodesSelector Property

Gets or sets a selector that returns the list of child nodes for the processed node. This is a dependency property.

Namespace : DevExpress.Xpf.Grid

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

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public IChildNodesSelector ChildNodesSelector { get; set; }
vb
Public Property ChildNodesSelector As IChildNodesSelector

Property Value

TypeDescription
IChildNodesSelector

The child nodes selector.

|

Remarks

The Child Nodes Selector returns node children. You can use the returned list of child nodes to create a hierarchical data structure for different object types.

csharp
public class ProjectObject : BaseObject {
    public ObservableCollection<ProjectStage> Stages { get; set; }
}

public class ProjectStage : BaseObject {
    public ObservableCollection<Task> Tasks { get; set; }
}

public class Task : BaseObject {
    State state;
    // ...
}
vb
Public Class ProjectObject
    Inherits BaseObject

    Public Property Stages As ObservableCollection(Of ProjectStage)
End Class

Public Class ProjectStage
    Inherits BaseObject

    Public Property Tasks As ObservableCollection(Of Task)
End Class

Public Class Task
    Inherits BaseObject

    Private state As State
    ' ...
End Class
  1. Create a selector class that implements IChildNodesSelector, and override the SelectChildren(Object) method that returns node children.

  2. Assign the Child Nodes Selector to the ChildNodesSelector property.

Refer to the following help topic for more information: Hierarchical Data Structure.

See Also

TreeViewControl Class

TreeViewControl Members

DevExpress.Xpf.Grid Namespace