Programmatic tree operations live on HierarchicalTreeDataGridSource<TModel>.
Source.Expand(new IndexPath(0));
Source.Collapse(new IndexPath(0));
Source.ExpandAll();
Source.CollapseAll();
You can also expand or collapse recursively:
Source.ExpandCollapseRecursive(x => x.IsExpandedByDefault);
Hierarchical sources raise:
RowExpandingRowExpandedRowCollapsingRowCollapsedThese events now use TreeDataGridRowModelEventArgs:
Source.RowExpanded += (_, e) =>
{
var model = (Person?)e.Row.Model;
var path = e.Row.ModelIndexPath;
};
Use the Source workflow when you need programmatic control over the expansion state. Declarative ItemsSource grids are useful for markup-driven tree layouts, but the explicit source remains the path for advanced runtime tree management.