XAML Usage Overview

This section documents TreeDataGrid from a XAML-first perspective: declaring controls, wiring templates, loading themes, and customizing visuals.

What You Will Learn

  • how sample projects structure TreeDataGrid in XAML
  • how to include and use TreeDataGrid themes
  • how model code (TemplateColumn<TModel>) resolves XAML template resource keys
  • how to customize theme resources and selectors safely

Typical XAML-First Setup

<Application xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             x:Class="MyApp.App">
  <Application.Styles>
    <FluentTheme/>
    <StyleInclude Source="avares://Avalonia.Controls.TreeDataGrid/Themes/Fluent.axaml"/>
  </Application.Styles>
</Application>
<TreeDataGrid Source="{Binding Source}"/>

Article Map

Troubleshooting

  • Control renders but appears unstyled Cause: TreeDataGrid theme include is missing. Fix: include Fluent.axaml or Generic.axaml from Avalonia.Controls.TreeDataGrid/Themes.

  • Template column content is blank Cause: template key not found or wrong DataType/binding path in XAML template. Fix: validate template key names and inspect Template Resource Keys from Model.

API Coverage Checklist