TreeDataGrid exposes lifecycle and interaction hooks for advanced behaviors.
CellPrepared: realized and ready for customizationCellClearing: being unrealized/recycledCellValueChanged: value committed from edit interactionExample:
grid.CellPrepared += (_, e) =>
{
// e.Cell, e.ColumnIndex, e.RowIndex
};
grid.CellValueChanged += (_, e) =>
{
// react to committed edits
};
RowPreparedRowClearingUseful for row-level instrumentation.
SelectionChanging can cancel selection updates:
grid.SelectionChanging += (_, e) =>
{
if (ShouldBlockSelection())
e.Cancel = true;
};
RowDragStartedRowDragOverRowDropSee Drag and Drop Rows.
Use these APIs to resolve TreeDataGrid visuals or models from controls and indexes.
TryGetRow(Control, out TreeDataGridRow?)TryGetCell(Control, out TreeDataGridCell?)TryGetRowModel<TModel>(Control, out TModel?)TryGetRow(int rowIndex)TryGetCell(int columnIndex, int rowIndex)Example:
if (grid.TryGetRow(10) is { } row)
{
row.Focus();
}
Common behavior toggles:
CanUserSortColumnsCanUserResizeColumnsShowColumnHeadersAutoDragDropRowsInternally, control syncs row/header scroll viewers and delegates keyboard/pointer/text input to active selection interaction.
This means changing Source.Selection can materially change keyboard/pointer behavior without changing UI markup.
Feature behavior differs from expectations
Cause: one or more options in this scenario are configured differently (source type, column options, sort/selection/edit state).
Fix: compare your setup with the snippet in this article and verify runtime values on Source, Columns, and Selection.
Data changes are not visible in UI
Cause: model or collection notifications are missing, or a replaced collection/source is not re-bound.
Fix: ensure INotifyPropertyChanged/INotifyCollectionChanged flow is active and reassign Source after replacing underlying collections.