Installation

This guide configures TreeDataGrid in an Avalonia project and verifies that it renders correctly.

1. Add NuGet Package

dotnet add package TreeDataGrid.Controls.Avalonia

If you use PackageReference directly:

<ItemGroup>
  <PackageReference Include="TreeDataGrid.Controls.Avalonia" Version="*" />
</ItemGroup>

The Avalonia UI package uses these distribution identities:

  • NuGet package: TreeDataGrid.Controls.Avalonia
  • runtime assembly: TreeDataGrid.Avalonia.dll
  • theme URI root: avares://TreeDataGrid.Avalonia/

2. Add TreeDataGrid Theme

Add the style include 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://TreeDataGrid.Avalonia/Themes/Fluent.axaml"/>
  </Application.Styles>
</Application>

Existing applications may keep the compatibility TreeDataGrid package and its avares://Avalonia.Controls.TreeDataGrid/... URI. Do not reference both UI packages in one application. See Package and Assembly.

3. Verify Rendering

Add a minimal control instance to any window:

<TreeDataGrid />

Run the app. If styling is loaded correctly, the control template is applied (not a plain empty rectangle).

4. Verify with a Bound Source

When available, bind Source to your view model:

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

Then proceed to:

Troubleshooting

If setup still fails after installation, use the checks below.

Control appears unstyled

Cause: missing StyleInclude in App.axaml.

Fix: ensure this exists:

<StyleInclude Source="avares://TreeDataGrid.Avalonia/Themes/Fluent.axaml"/>

Build succeeds but control does not appear

Cause: DataContext or Source binding is null.

Fix: verify:

  • view DataContext is set
  • Source property exists and is initialized
  • TreeDataGrid Source="{Binding Source}" path matches property name

API Coverage Checklist