Back to Devexpress

TreeListView.ChildNodesPath Property

wpf-devexpress-dot-xpf-dot-grid-dot-treelistview-474e17f0.md

latest2.8 KB
Original Source

TreeListView.ChildNodesPath Property

Gets or sets the name of the ‘children’ field. 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 string ChildNodesPath { get; set; }
vb
Public Property ChildNodesPath As String

Property Value

TypeDescription
String

A String value that specifies the ‘children’ field name.

|

Remarks

View Example: Implement the Child Nodes Path

Use the Child Nodes Path to bind the TreeListView to a collection if all objects have the same children field. An example of such a structure is shown below:

csharp
public class BaseObject {
    public string Name { get; set; }
    public String Executor { get; set; }
    public ObservableCollection<Task> Tasks { get; set; }
}

public class ProjectObject : BaseObject {}

public class Task : BaseObject {
    public string State { get; set; }
}
vb
Public Class BaseObject
    Public Property Name As String
    Public Property Executor As String
    Public Property Tasks As ObservableCollection(Of Task)
End Class

Public Class ProjectObject
    Inherits BaseObject
End Class

Public Class Task
    Inherits BaseObject

    Public Property State As String
End Class
  1. Set the ChildNodesPath property to the children field name.
  2. Set the TreeListView.TreeDerivationMode property to ChildNodesSelector.

Set the TreeListView.AllowChildNodeSourceUpdates property to true to update child nodes when you set the collection property to a new value.

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

See Also

TreeDerivationMode

TreeListView Class

TreeListView Members

DevExpress.Xpf.Grid Namespace