Pilot: TableView instead of DataGrid in the OCR subtitle grid - #13001
Merged
Conversation
Second TableView pilot after Show history (#12704), targeting SE's heaviest grid - virtualized template columns with a bitmap per row - to judge TableView's scrolling against DataGrid's. DataGrid -> TableView mapping: template columns carry over via TableViewColumn.CellTemplate (cell content is the row item), text columns via Binding; the Forced column is added conditionally since TableViewColumn has no IsVisible; extended selection (shift/ctrl-click, shift+arrows) is native ListBox behavior, replacing DataGridCheckboxMultiSelect; ScrollIntoView takes an index; rows auto-size to content, so the Ctrl+plus/minus image zoom no longer needs the CalculateRowHeight/RowHeight dance. Column sorting is lost - TableView has none. Verified headlessly: columns declared and bound, rows realize with image and text cell templates resolving, selection round-trips both ways, 2000-item source stays virtualized and ScrollIntoView(1999) realizes the far end, multi-select surfaces in SelectedItems. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
TableView has no content-based column sizing - its layout helper treats GridLength.Auto as 1* - so the Auto columns from the previous commit all came out equal-width. Give the narrow columns pixel widths measured from their widest content (# from the item count, Show from the last start time, Duration from the max duration, each vs the header). The image column is sized from ImageMaxWidth and follows the Ctrl+plus/minus zoom via PropertyChanged; Text keeps the star width. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The header's right border was tied to the vertical grid-lines setting, so with grid lines off/horizontal the column headers ran together. Draw it unconditionally, like the header's bottom line - matching DataGrid, whose header separators are always on regardless of the grid-lines setting. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The TableView header was hard-coded transparent while DataGrid headers get a themed background. Default to the Fluent DataGridColumnHeader Background resource (falling back to transparent when absent), and give the three custom themes that restyle DataGridColumnHeader - lighter dark, classic gray, pastel - a matching TableViewColumnHeader style with the same brushes. App styles outrank the control theme, so the per-theme overrides win where they apply. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second
TableViewpilot after #12704 (Show history), this time on the opposite end of the spectrum: the OCR subtitle grid is SE's heaviest — virtualized template columns with a per-row bitmap — and the one where DataGrid scrolling feels worst. The point of this branch is to compare scrolling behaviour by eye.What changed
DataGrid→TableViewinOcrWindow.MakeSubtitleView. Template columns (Forced checkbox, image thumbnail, formatted text) carry over viaTableViewColumn.CellTemplate— with a template set, the cell's content is the row item, so the existingFuncDataTemplate<OcrSubtitleItem>s work unchanged. Text columns (#, Show, Duration) useTableViewColumn.Bindingwith the same converters.TableViewColumnhas noIsVisible), matching the old staticIsVisible = vm.HasForcedSubtitles.OcrViewModel.SubtitleGridis now typedTableView.SelectedItems/SelectedIndex/Focusare inherited from ListBox and unchanged;ScrollIntoView(item, null)becameScrollIntoView(index).ImageMaxHeight/ImageMaxWidthre-measures rows directly — theCalculateRowHeight()→RowHeightdance is gone.DataGridCheckboxMultiSelectis dropped: extended selection (shift/ctrl-click, cmd-click on macOS, shift+arrows) is native ListBox behaviour withSelectionMode.Multiple. The Mac ctrl+click context-menu handlers, the flyout, and all VM event handlers carry over unchanged.Known losses to judge
CanUserSortColumns = true).RowHeight, which is exactly the variable-height virtualization scenario worth stress-testing with scrolling.Verified headlessly (5 new tests): columns declared and bound; rows realize with the image and text cell templates resolving (fake
IOcrSubtitlewith real SKBitmaps); selection round-trips both ways between grid and VM; a 2000-item source stays virtualized andScrollIntoView(1999)realizes the far end; multi-select surfaces inSelectedItems. All 165 OCR UI tests pass.To judge by eye: open a Blu-ray sup / VobSub, scroll with wheel, scrollbar drag, and keyboard; try Ctrl+plus/minus image zoom mid-list; check the OCR run auto-follow (SelectAndScrollToRow) tracks smoothly.
🤖 Generated with Claude Code