TreeListView.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.v24.2.dll
NuGet Package: DevExpress.Wpf.Grid.Core
Declaration
Property Value
Type | Description |
---|---|
IChildNodesSelector | The child nodes selector. |
Remarks
Use the Child Nodes Selector to create a hierarchical data structure in the TreeListView. An example of this structure is shown below:
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;
// ...
}
Create a selector class that implements IChildNodesSelector, and override the SelectChildren(Object) method that returns node children.
For the Project-Stage-Task class structure, the selector class is as follows:
Assign the Child Nodes Selector to the
ChildNodesSelector
property.Set the TreeListView.TreeDerivationMode property to
ChildNodesSelector
.<dxg:TreeListControl ...> <dxg:TreeListControl.Resources> <local:CustomChildrenSelector x:Key="childrenSelector"/> </dxg:TreeListControl.Resources> <dxg:TreeListControl.View> <dxg:TreeListView TreeDerivationMode="ChildNodesSelector" ChildNodesSelector="{StaticResource childrenSelector}"/> </dxg:TreeListControl.View> </dxg:TreeListControl>
Tip
If all objects have the same children field, assign its name to the TreeListView.ChildNodesPath property. Otherwise, create a Child Nodes Selector.
Refer to the following help topic for more information: Bind to Hierarchical Data Structure.
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the ChildNodesSelector property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.