![]() |
VOOZH | about |
dotnet add package TreeDataGrid --version 12.0.0
NuGet\Install-Package TreeDataGrid -Version 12.0.0
<PackageReference Include="TreeDataGrid" Version="12.0.0" />
<PackageVersion Include="TreeDataGrid" Version="12.0.0" />Directory.Packages.props
<PackageReference Include="TreeDataGrid" />Project file
paket add TreeDataGrid --version 12.0.0
#r "nuget: TreeDataGrid, 12.0.0"
#:package TreeDataGrid@12.0.0
#addin nuget:?package=TreeDataGrid&version=12.0.0Install as a Cake Addin
#tool nuget:?package=TreeDataGrid&version=12.0.0Install as a Cake Tool
TreeDataGrid for AvaloniaTreeDataGrid is a control for the Avalonia UI framework which displays hierarchical and tabular data together in a single view. It is a combination of a TreeView and DataGrid control.
The control has two modes of operation:
DataGrid controlsAn example of TreeDataGrid displaying hierarchical data:
An example of TreeDataGrid displaying flat data:
We accept all issues and pull requests but we answer and review only pull requests and issues that are high quality and align with project scope.
Install the package:
dotnet add package TreeDataGrid
Or add a package reference:
<ItemGroup>
<PackageReference Include="TreeDataGrid" Version="x.y.z" />
</ItemGroup>
Add the theme to App.axaml:
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="AvaloniaApplication.App">
<Application.Styles>
<FluentTheme/>
<StyleInclude Source="avares://Avalonia.Controls.TreeDataGrid/Themes/Fluent.axaml"/>
</Application.Styles>
</Application>
using System.Collections.ObjectModel;
using Avalonia.Controls.Models.TreeDataGrid;
public class Person
{
public string? FirstName { get; set; }
public string? LastName { get; set; }
public int Age { get; set; }
}
public class MainWindowViewModel
{
private readonly ObservableCollection<Person> _people = new()
{
new() { FirstName = "Eleanor", LastName = "Pope", Age = 32 },
new() { FirstName = "Jeremy", LastName = "Navarro", Age = 74 },
};
public FlatTreeDataGridSource<Person> Source { get; }
public MainWindowViewModel()
{
Source = new FlatTreeDataGridSource<Person>(_people)
{
Columns =
{
new TextColumn<Person, string>("First Name", x => x.FirstName),
new TextColumn<Person, string>("Last Name", x => x.LastName),
new TextColumn<Person, int>("Age", x => x.Age),
},
};
}
}
If you prefer to define columns in XAML in Avalonia 12, expose the raw collection instead:
using System.Collections.ObjectModel;
public class MainWindowViewModel
{
public ObservableCollection<Person> People { get; } = new()
{
new() { FirstName = "Eleanor", LastName = "Pope", Age = 32 },
new() { FirstName = "Jeremy", LastName = "Navarro", Age = 74 },
};
}
<TreeDataGrid ItemsSource="{Binding People}">
<TreeDataGridTextColumn Header="First Name"
Binding="{Binding FirstName}"/>
<TreeDataGridTextColumn Header="Last Name"
Binding="{Binding LastName}"/>
<TreeDataGridTextColumn Header="Age"
Binding="{Binding Age}"/>
</TreeDataGrid>
using System.Collections.ObjectModel;
using Avalonia.Controls.Models.TreeDataGrid;
public class Person
{
public string? FirstName { get; set; }
public string? LastName { get; set; }
public int Age { get; set; }
public ObservableCollection<Person> Children { get; } = new();
}
public class MainWindowViewModel
{
private readonly ObservableCollection<Person> _people = new();
public HierarchicalTreeDataGridSource<Person> Source { get; }
public MainWindowViewModel()
{
Source = new HierarchicalTreeDataGridSource<Person>(_people)
{
Columns =
{
new HierarchicalExpanderColumn<Person>(
new TextColumn<Person, string>("First Name", x => x.FirstName),
x => x.Children),
new TextColumn<Person, string>("Last Name", x => x.LastName),
new TextColumn<Person, int>("Age", x => x.Age),
},
};
}
}
Bind code-defined sources in XAML (both modes):
<TreeDataGrid Source="{Binding Source}" />
Build/test/pack the library project:
dotnet restore src/Avalonia.Controls.TreeDataGrid/Avalonia.Controls.TreeDataGrid.csproj
dotnet build src/Avalonia.Controls.TreeDataGrid/Avalonia.Controls.TreeDataGrid.csproj -c Release --no-restore
dotnet test tests/Avalonia.Controls.TreeDataGrid.Tests/Avalonia.Controls.TreeDataGrid.Tests.csproj -c Release
dotnet pack src/Avalonia.Controls.TreeDataGrid/Avalonia.Controls.TreeDataGrid.csproj -c Release -o artifacts/packages
Packages are generated in artifacts/packages (.nupkg and .snupkg).
Build docs locally:
./build-docs.sh
Serve docs locally:
./serve-docs.sh
Default local URL: http://127.0.0.1:8080
Override host/port with DOCS_HOST and DOCS_PORT.
Generated docs output is written to site/.lunet/build/www.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 1 NuGet packages that depend on TreeDataGrid:
| Package | Downloads |
|---|---|
|
OneWare.Essentials
Essentials Needed for One Ware Plugin Development |
Showing the top 1 popular GitHub repositories that depend on TreeDataGrid:
| Repository | Stars |
|---|---|
|
one-ware/OneWare
Next Generation IDE for Electronics Development
|
| Version | Downloads | Last Updated |
|---|---|---|
| 12.0.0 | 1,830 | 4/8/2026 |
| 12.0.0-rc1 | 66 | 3/19/2026 |
| 12.0.0-preview2 | 72 | 3/6/2026 |
| 12.0.0-preview1 | 66 | 3/3/2026 |
| 11.3.12.1 | 143 | 3/4/2026 |
| 11.3.12 | 962 | 3/3/2026 |