TreeDataGrid now exposes selection configuration directly on the control through SelectionMode.
Row: single row selectionRow,Multiple: multiple row selectionCell: single cell selectionCell,Multiple: multiple cell selection<TreeDataGrid ItemsSource="{Binding People}"
SelectionMode="Row,Multiple"/>
You can listen to TreeDataGrid.SelectionChanged without reaching into the source selection model:
private void OnSelectionChanged(object? sender, TreeDataGridSelectionChangedEventArgs e)
{
foreach (var item in e.SelectedItems)
{
// ...
}
}
The event args expose:
SelectedIndexes and DeselectedIndexesSelectedItems and DeselectedItemsSelectedCellIndexes and DeselectedCellIndexesIf you use the code Source path, the underlying row and cell selection models now raise TreeDataGridSelectionChangedEventArgs as well.