wpf-devexpress-dot-xpf-dot-grid-dot-treelistview-8b9d3410.md
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
public IChildNodesSelector ChildNodesSelector { get; set; }
Public Property ChildNodesSelector As IChildNodesSelector
| Type | Description |
|---|---|
| IChildNodesSelector |
The child nodes selector.
|
Run Demo: Child Nodes Selector View Example: Use the Child Nodes Selector to Display Hierarchical Data
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;
// ...
}
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
Create a selector class that implements IChildNodesSelector, and override the SelectChildren(Object) method that returns node children.
Assign the Child Nodes Selector to the ChildNodesSelector property.
Set the TreeListView.TreeDerivationMode property to ChildNodesSelector.
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.
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.
wpf-spreadsheet-chart-api/CS/SpreadsheetWPFChartAPISamples/MainWindow.xaml#L52
<dxg:TreeListControl.View>
<dxg:TreeListView x:Name="view" TreeDerivationMode="ChildNodesSelector" ChildNodesSelector="{StaticResource childrenSelector}" ShowIndicator="False" ShowColumnHeaders="False" AutoWidth="True" AllowPerPixelScrolling="False" CustomColumnDisplayText="view_CustomColumnDisplayText" />
</dxg:TreeListControl.View>
wpf-spreadsheet-pivot-table-api-examples/CS/SpreadsheetWPFPivotTableExamples/MainWindow.xaml#L52
<dxg:TreeListControl.View>
<dxg:TreeListView x:Name="view" TreeDerivationMode="ChildNodesSelector" ChildNodesSelector="{StaticResource childrenSelector}" ShowIndicator="False" ShowColumnHeaders="False" AutoWidth="True" AllowPerPixelScrolling="False" CustomColumnDisplayText="view_CustomColumnDisplayText" />
</dxg:TreeListControl.View>
wpf-richedit-document-api/CS/DXRichEditControlAPISample/MainWindow.xaml#L57
<dxg:TreeListControl.View>
<dxg:TreeListView x:Name="view" TreeDerivationMode="ChildNodesSelector" ChildNodesSelector="{StaticResource childrenSelector}" ShowIndicator="False" ShowColumnHeaders="False" AutoWidth="True" AllowPerPixelScrolling="False" CustomColumnDisplayText="view_CustomColumnDisplayText" />
</dxg:TreeListControl.View>
See Also
Load Nodes Asynchronously Without Locking the Application's UI