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.v24.2.dll
NuGet Package: DevExpress.Wpf.Grid.Core
Declaration
Property Value
Type | Description |
---|---|
String | A String value that specifies the ‘children’ field name. |
Remarks
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:
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; }
}
- Set the
ChildNodesPath
property to the children field name. Set the TreeListView.TreeDerivationMode property to
ChildNodesSelector
.In the code sample below, the Tasks field is the children field:
<dxg:TreeListControl Name="treeListView1" ItemsSource="{Binding DataItems}"> <dxg:TreeListControl.Columns> <dxg:TreeListColumn FieldName="Name" AllowSorting="True" /> <dxg:TreeListColumn FieldName="Executor" AllowSorting="True" /> <dxg:TreeListColumn FieldName="State" AllowSorting="True" /> </dxg:TreeListControl.Columns> <dxg:TreeListControl.View> <dxg:TreeListView TreeDerivationMode="ChildNodesSelector" ChildNodesPath="Tasks"/> </dxg:TreeListControl.View> </dxg:TreeListControl>
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.