TreeDataGrid 11.3.12.1

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package TreeDataGrid --version 11.3.12.1
                    
NuGet\Install-Package TreeDataGrid -Version 11.3.12.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TreeDataGrid" Version="11.3.12.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TreeDataGrid" Version="11.3.12.1" />
                    
Directory.Packages.props
<PackageReference Include="TreeDataGrid" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TreeDataGrid --version 11.3.12.1
                    
#r "nuget: TreeDataGrid, 11.3.12.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package TreeDataGrid@11.3.12.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TreeDataGrid&version=11.3.12.1
                    
Install as a Cake Addin
#tool nuget:?package=TreeDataGrid&version=11.3.12.1
                    
Install as a Cake Tool

NuGet

TreeDataGrid for Avalonia

Introduction

TreeDataGrid 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:

  • Hierarchical: data is displayed in a tree with optional columns
  • Flat: data is displayed in a 2D table, similar to other DataGrid controls

An example of TreeDataGrid displaying hierarchical data:

TreeDataGrid in hierarchical mode

An example of TreeDataGrid displaying flat data:

TreeDataGrid in flat mode

Current Status

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.

Quick Start

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>

Basic Usage

Flat mode

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),
            },
        };
    }
}

Hierarchical mode

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 in XAML (both modes):

<TreeDataGrid Source="{Binding Source}" />

Build and Package

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 Documentation

Build docs locally:

./build-docs.sh

Serve docs locally:

./serve-docs.sh

Generated docs output is written to _site.

Getting Started

License

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on TreeDataGrid:

Package Downloads
OneWare.Essentials

Essentials Needed for One Ware Plugin Development

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
12.0.0-preview2 37 3/6/2026
12.0.0-preview1 35 3/3/2026
11.3.12.1 35 3/4/2026
11.3.12 86 3/3/2026