Accessibility and UI Automation

TreeDataGrid exposes a full Avalonia automation surface for the grid root, rows, cells, and headers.

Use this layer when you need:

  • screen-reader friendly selection and focus behavior
  • reliable UI automation for tests or tooling
  • custom control derivations that must preserve accessibility contracts

Automation Peer Namespace

The public automation peer types live in Namespace: Avalonia.Controls.Automation.Peers.

Root Control Automation

TreeDataGridAutomationPeer represents the grid itself.

It exposes:

  • AutomationControlType.DataGrid
  • selection-provider behavior for row selection
  • source-aware updates when the bound ITreeDataGridSource changes

Row and Cell Automation

Realized rows and cells expose dedicated peers:

These peers bridge TreeDataGrid concepts to standard automation patterns:

  • row selection
  • expand/collapse for hierarchical rows
  • toggle state for check box cells
  • value-provider access where a row exposes textual value

Header Automation

Column headers are surfaced separately:

This keeps header navigation and sortable-column discovery visible to automation clients without mixing that behavior into row peers.

Guidance

  • Prefer the built-in automation peers when using the standard control and templates.
  • If you subclass TreeDataGrid or replace presenter elements, keep the same automation roles and provider contracts.
  • Test accessibility-sensitive changes together with selection, expansion, and check box interaction.

API Coverage Checklist