wpf-devexpress-dot-xpf-dot-grid-dot-treelistview-dee1132c.md
Gets or sets a name of a data source’s field that determines whether a node has children. This is a dependency property.
Namespace : DevExpress.Xpf.Grid
Assembly : DevExpress.Xpf.Grid.v25.2.dll
NuGet Package : DevExpress.Wpf.Grid.Core
public string HasChildNodesPath { get; set; }
Public Property HasChildNodesPath As String
| Type | Description |
|---|---|
| String |
The name of a data source’s field that determines whether a node has children.
|
Note
A TreeListView with the Self-Referential data structure (TreeDerivationMode is set to Selfreference) ignores the HasChildNodesPath property.
The TreeListView in hierarchical binding mode fetches child nodes of sub-level nodes when you expand their parent node. If the TreeListView.FetchSublevelChildrenOnExpand property is false , all the child nodes display expand buttons (even if they do not have children) after you expand their parent node. The expand button is hidden when you expand a sub-level node that does not contain child nodes:
<dxg:GridControl Name="treeListView1" ItemsSource="{Binding DataItems}">
<dxg:GridControl.Columns>
<dxg:GridColumn FieldName="Name"/>
<dxg:GridColumn FieldName="Executor"/>
<dxg:GridColumn FieldName="State"/>
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TreeListView TreeDerivationMode="ChildNodesSelector" ChildNodesPath="Tasks"
FetchSublevelChildrenOnExpand="False"/>
</dxg:GridControl.View>
</dxg:GridControl>
You can make a node display an expand button only if this node has children:
In a data source, create a field that determines whether a node has children (the HasChildNodes field in the code sample below). In this case, the TreeListView will know for which nodes display expand buttons:
Specify the TreeListView.HasChildNodesPath property to this field’s name:
View Example: Control Visibility of Expand Buttons when Sub-level Children are not Fetched
Read Tutorial: Expand and Collapse Nodes
You can control whether to create child nodes for a node. The following example shows how to prevent the TreeListView from creating child nodes for the Information Gathering node:
In a data source, create a field that determines whether a node has children (the HasChildNodes field in the code sample below):
Specify the TreeListView.HasChildNodesPath property to this field’s name:
View Example: Control Whether to Create Child Nodes
Read Tutorial: Bind to Hierarchical Data Structure
See Also