Skip to main content

Indented tree chart

info

Charts are available with Avalonia Pro.

Indented tree charts represent hierarchies using a layout similar to a standard file explorer or tree view, but within a charting container for advanced styling and interactions.

Indented tree chart showing a file-explorer-style hierarchy with parent and child nodes offset by indentation.

When to use

  • File system explorer: Building custom navigators for local or cloud storage.
  • Bill of materials (BOM): Showing a multi-level product structure in manufacturing.
  • Settings/config: Grouping complex nested configuration options visually.

Code example

XAML

<charts:IndentedTreeChart Name="IndentedTreeChartSample" Height="320"
ItemsSource="{Binding IndentedTreeData}"
LabelPath="Name"
ChildrenPath="Children" />

Data model (C#)

public class TreeNode
{
public string Name { get; set; } = string.Empty;
public ObservableCollection<TreeNode> Children { get; set; } = new();
}

public ObservableCollection<TreeNode> IndentedTreeData { get; } = new()
{
new TreeNode { Name = "src", Children = {
new TreeNode { Name = "components", Children = {
new TreeNode { Name = "Button.cs" },
new TreeNode { Name = "Chart.cs" }
}},
new TreeNode { Name = "models", Children = {
new TreeNode { Name = "User.cs" }
}},
new TreeNode { Name = "Program.cs" }
}},
};

Common properties

PropertyDescriptionDefault
ItemsSourceThe root level nodes.null
ValuePathOptional numeric value displayed next to each label.null
LabelPathThe property name for the item text.null
ChildrenPathThe property name for child collections.null
IndentSizeThe horizontal offset for each hierarchy level.20.0
RowHeightThe height of each rendered row.24.0
ShowLinesWhether to display connector lines between nodes.true
ShowIconsWhether to display folder and leaf icons.true