Skip to content

TableView sweep batch 3: last three sorting grids + retire the DataGrid package - #13020

Merged
niksedk merged 2 commits into
mainfrom
experiment/tableview-batch3
Jul 31, 2026
Merged

TableView sweep batch 3: last three sorting grids + retire the DataGrid package#13020
niksedk merged 2 commits into
mainfrom
experiment/tableview-batch3

Conversation

@niksedk

@niksedk niksedk commented Jul 31, 2026

Copy link
Copy Markdown
Member

Final batch of the TableView migration (#13017, #13018, #13019). Zero DataGrids remain; the Avalonia.Controls.DataGrid package is gone from the build.

Conversions (sorting kept via TableViewHeaderSorter)

  • Shortcuts — all five columns sortable (ActiveIn, group, category, name, shortcut); widths measured from actual content at construction; header double-click sorts instead of opening the detect-key dialog. Note: a search/filter change rebuilds the list in default order (the DataGrid's view-sort survived refilters).
  • BatchConvert — file grid sortable by name/format/status and by raw byte size (better than the old string sort). Found + fixed a pre-existing hazard: the conversion loop enumerated the live ObservableCollection from a background task (a mid-run filter change could throw); it now snapshots the job list, which also makes mid-run sorting safe. The functions checklist keeps fixed order and now shows headers (TableView can't hide them).
  • FixCommonErrors — rules and fixes grids fully sortable. Rule execution order is now decoupled from display order (ApplyFixes runs selected rules in canonical order), so a cosmetic sort can never change fix results — under the DataGrid this held only because sorting was view-level.

Sorter perf fix

Headless benchmarking (10k rows) showed SelectedItems.Add is O(n) per call on ListBox-based controls (8.6 s for 2,000 adds) while a batched SelectRange is ~4 ms. The sorter now refills the collection detached and restores selection through the selection model by index.

For the record, DataGrid vs TableView on identical 10k-row data: first layout 378 → 44 ms, ItemsSource reset ×10 480 → 64 ms, scroll jumps comparable.

DataGrid retirement

  • Package reference, theme include, and both behavior classes (DataGridScrollBarBehavior, DataGridCheckboxMultiSelect) deleted; DataGrid styles stripped from UiTheme/Styles.axaml; DataGrid cell themes and helpers removed from UiUtil.
  • Grid-lines setting enum is now SE-owned (SeGridLinesVisibility, same member names — persisted settings keep working).
  • The TableView header background resource the DataGrid theme used to supply is now defined in Styles.axaml with the same value.

Testing

Full solution builds clean; all 983 UI tests pass (one obsolete trough-paging test removed with its subject). Smoke-test priorities:

  • Shortcuts: sort each column, edit a shortcut after sorting, search-filter reset
  • BatchConvert: sort by size, run a batch, sort mid-run, filter mid-run
  • FixCommonErrors: sort rules then verify fix results are unchanged; sort fixes and apply a subset
  • Theme check (default + custom): grid headers still have their background everywhere
  • macOS "Show scroll bars: Always" still gives expanded scrollbars (the DataGrid-specific workaround was removed; ListBox path remains)

🤖 Generated with Claude Code

niksedk and others added 2 commits July 31, 2026 12:28
…rrors)

Batch 3 of the TableView sweep: the three windows with deliberate
SortMemberPath sorting keep their sorting via TableViewHeaderSorter,
wired on every previously sortable column.

- Shortcuts: all five columns sortable; column widths measured from
  actual content at construction; header double-click guarded so it
  sorts instead of opening the detect-key dialog. List order is
  presentation-only (rebuilt by search/filter).
- BatchConvert: file grid sortable by name/format/status and by raw
  byte size (better than the DataGrid's string sort). The conversion
  loop enumerated the live ObservableCollection from a background task
  - a pre-existing crash hazard with mid-run filter changes - and now
  snapshots the job list, which also makes mid-run sorting safe. The
  functions checklist keeps its fixed order (headers were hidden
  before; TableView always shows them) and gets a fixed width against
  the Auto-cell star-column trap.
- FixCommonErrors: rule execution order is now decoupled from the rules
  grid's display order (ApplyFixes runs selected rules in canonical
  _allFixRules order), since the sorter reorders the backing collection
  where the DataGrid sorted a view - a cosmetic sort can never change
  fix results. Both rules and fixes grids fully sortable; fixes apply
  per-item by identity.

Also: TableViewHeaderSorter now refills the collection detached and
restores selection through the selection model by index - headless
benchmarking showed per-item SelectedItems.Add is O(n) each (8.6s for
2,000 adds on a 10k-row grid) while a batch range select is ~4ms.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
With every grid converted to TableView, the DataGrid infrastructure goes:

- Package reference removed from UI.csproj; theme include and the
  DataGrid double-tap scrollbar guard removed from Program.cs; the
  DataGrid Loaded scrollbar-autohide workaround removed from UiTheme.
- DataGridScrollBarBehavior and DataGridCheckboxMultiSelect deleted
  (native ScrollViewer paging and ListBox extended selection +
  TableViewExtras.AddSpaceToggle replaced them), along with the
  trough-paging test.
- DataGrid cell themes and AttachHomeEndNavigation(DataGrid) removed
  from UiUtil; DataGrid styles removed from UiTheme and Styles.axaml.
- The grid-lines setting enum is now SE's own SeGridLinesVisibility;
  member names match the old DataGridGridLinesVisibility, so persisted
  GridLinesAppearance values keep working.
- The TableView header background resource
  (DataGridColumnHeaderBackgroundBrush, previously supplied by the
  DataGrid theme) is now defined in Styles.axaml with the same
  SystemAltHighColor value; SE's custom themes still override the
  header background directly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@niksedk
niksedk marked this pull request as ready for review July 31, 2026 10:39
@niksedk
niksedk merged commit d65a2af into main Jul 31, 2026
0 of 2 checks passed
@niksedk
niksedk deleted the experiment/tableview-batch3 branch July 31, 2026 10:39
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