Class HierarchicalDataTemplate
A DataTemplate that also says where an item's children are, for a TreeView.
public class HierarchicalDataTemplate : DataTemplate
- Inheritance
-
HierarchicalDataTemplate
- Inherited Members
- Extension Methods
Remarks
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ChildrenPath="Children">
<TextBlock Text="{Binding Name}"/>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
ChildrenPath is resolved against each item's runtime type. A value that isn't an IEnumerable, or is a string, means "no children".
Properties
ChildrenPath
Gets or sets the property path, relative to an item, of the item's children collection; or null for items without children.
public string? ChildrenPath { get; set; }
Property Value
Methods
GetChildren(object)
Gets item's children through ChildrenPath.
public IEnumerable? GetChildren(object item)
Parameters
itemobjectThe data item.
Returns
- IEnumerable
The children, or null when the path is unset, can't be resolved, or isn't a collection.