This guide configures TreeDataGrid in an Avalonia project and verifies that it renders correctly.
dotnet add package TreeDataGrid
If you use PackageReference directly:
<ItemGroup>
<PackageReference Include="TreeDataGrid" Version="*" />
</ItemGroup>
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://Avalonia.Controls.TreeDataGrid/Themes/Fluent.axaml"/>
</Application.Styles>
</Application>
Note: keep the URI as avares://Avalonia.Controls.TreeDataGrid/....
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).
When available, bind Source to your view model:
<TreeDataGrid Source="{Binding Source}" />
Then proceed to:
If setup still fails after installation, use the checks below.
Cause: missing StyleInclude in App.axaml.
Fix: ensure this exists:
<StyleInclude Source="avares://Avalonia.Controls.TreeDataGrid/Themes/Fluent.axaml"/>
Cause: DataContext or Source binding is null.
Fix: verify:
DataContext is setSource property exists and is initializedTreeDataGrid Source="{Binding Source}" path matches property name