Skip to content

Pilot: TableView instead of DataGrid in Show history#12704

Open
niksedk wants to merge 4 commits into
mainfrom
experiment/tableview-showhistory
Open

Pilot: TableView instead of DataGrid in Show history#12704
niksedk wants to merge 4 commits into
mainfrom
experiment/tableview-showhistory

Conversation

@niksedk

@niksedk niksedk commented Jul 21, 2026

Copy link
Copy Markdown
Member

Experiment — a single-window pilot of Avalonia 12.1's new TableView, so we can judge it on real UI before deciding anything broader. Easy to revert.

Why this window: Show history is the simplest grid in SE — 2 text columns, read-only, no sorting, no cell themes, no LoadingRow, no visual-tree drilling, no column persistence. It's also trivially reachable (Edit → Show history) for eyeballing.

What changed: DataGridTableView, DataGridTextColumnTableViewColumn (Binding instead of a text-column binding), DataGridLengthGridLength (Auto and 3*Star map 1:1), DataGridSelectionMode.SingleSelectionMode.Single. IsReadOnly/AutoGenerateColumns have no equivalent and aren't needed — TableView is read-only by design and never auto-generates. The ItemsSource/SelectedItem bindings and the SelectionChanged handler carry over unchanged; the view model is untouched.

Verified headlessly (4 new tests): both columns declared with the right width units and ItemsSource bound; rows realize and cell text resolves through TableViewColumn.Binding; setting SelectedIndex round-trips to SelectedHistoryItem and enables the Rollback button; and virtualization works — a 2000-item history realizes 13 rows.

Still to judge by eye (can't be asserted headlessly): default row height, header styling, padding and grid-line appearance versus the DataGrid look, since this window doesn't use SE's DataGridCell cell themes.

Natural next step if this looks right: ReviewSpeechHistoryWindow, which exercises CellTheme (SE has ~385 uses that would need TableViewCell equivalents) and an interactive button CellTemplate.

🤖 Generated with Claude Code

niksedk and others added 4 commits July 21, 2026 16:29
DataGrid is in maintenance mode upstream; TableView is the recommended
control for read-only tabular data. Show history is SE's simplest grid
(read-only, no sorting, no cell themes, no row hacks), so it is used to
validate parity before considering wider adoption.

Adds headless tests covering what the DataGrid provided: column
declaration with Auto/Star widths, row realization and cell binding,
selection round-tripping to the view model, and virtualization
(2000 items realize 13 rows).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
TableView has no GridLinesVisibility property, so draw the lines as cell
borders from the same Appearance.GridLinesAppearance setting (a
DataGridGridLinesVisibility name) the DataGrid cell themes use - None,
Horizontal, Vertical and All now all behave identically in both controls.

TableViewCell's built-in template only template-binds Background, so
setting BorderBrush/BorderThickness alone drew nothing; the theme also
supplies a template passing them to the ContentPresenter that paints them.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
TableViewRow is a ListBoxItem whose default padding sits outside the
cells, so cells were 18px tall inside 39px rows: horizontal lines floated
above the row edge and vertical lines were drawn as one short segment per
row instead of continuous columns.

Zero the row padding so cells fill the row, and move the inset into the
cell padding (4px horizontal so text clears the vertical line, vertical
from compact mode). Rows are now 22px with cells filling them edge to
edge, so the lines join up.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Two leftovers from the pilot's grid lines:

- The first row had no line above it: cells only draw bottom borders and
  the header drew none. The header now draws a bottom line.
- The vertical divider did not match between header and rows. TableView
  insets the header in a Border with hard-coded 6,9,6,12 padding while
  rows sit flush against the control edge, so the header divider landed
  6px right of the cell dividers - and in a different colour, because the
  built-in header draws its separator as a semi-transparent rectangle
  inside the resize thumb.

Adds a column-header theme matching the cell theme (same brush, same text
inset, right + bottom borders) with a template that routes the border
properties to the presenter and keeps the PART_Resizer thumb so column
resizing still works, and zeroes the header Border's padding on Loaded.
Header and cell dividers now share an x, and the header's bottom line sits
exactly on the first row's top edge.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant