TreeDataGrid v12 introduces a new XAML-first workflow and a new fluent source API. The most important changes are:
TreeDataGrid*Column types.ItemsSource plus declarative columns is now a first-class setup path.WithTextColumn and WithHierarchicalExpanderColumn.*CreateOptions types and CanUserResizeColumn became CanUserResize.true.SelectionMode and control-level SelectionChanged were added to TreeDataGrid.TreeDataGridRowModelEventArgs.TextSearchBinding.FlatTreeDataGridSource<TModel> and HierarchicalTreeDataGridSource<TModel> are sealed.source.WithTextColumn("Name", x => x.Name, o => o.Width = GridLength.Star);
source.WithCheckBoxColumn("Active", x => x.IsActive);
source.WithTemplateColumnFromResourceKeys("Status", "StatusCell", "StatusEditCell", o =>
{
o.TextSearchBinding = new Avalonia.Data.Binding("Name");
});
source.WithHierarchicalExpanderTextColumn(x => x.Name, x => x.Children, o =>
{
o.HasChildren = x => x.HasChildren;
o.IsExpanded = x => x.IsExpanded;
});
Older code typically bound only Source. In v12-style code you can declare columns directly on the control:
<TreeDataGrid ItemsSource="{Binding People}">
<TreeDataGridTextColumn Header="Name"
Binding="{Binding Name}"/>
</TreeDataGrid>