Skip to content

feat: Let TableView be a SemanticZoom view again - #525

Merged
w-ahmad merged 2 commits into
mainfrom
claude/grouping-semantic-zoom-v2-c6c61c
Nov 30, 2026
Merged

w-ahmad merged 2 commits into
mainfrom
claude/grouping-semantic-zoom-v2-c6c61c

Conversation

@w-ahmad

@w-ahmad w-ahmad commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

Description

In v1 TableView derived from ListView, so a grouped table could be the zoomed-in view of a SemanticZoom. The v2 table derives from Control and lost ISemanticZoomInformation. This PR implements it again on Windows (Uno Platform has no SemanticZoom).

  • Picking a group in the zoomed-out view scrolls its header to the top of the table. A CollectionGroups entry, a TableViewGroupInfo, an item of the table or the key of an outermost group can be picked, looked up in that order. Picking an item inside collapsed groups expands them and scrolls to it.
  • Zooming out lands on the group at the top of the viewport. With nested grouping that is the innermost group.
  • Clicking or tapping a group header zooms out to that group, as ListViewHeaderItem did in v1. The expand/collapse button, any other focusable control and a hyperlink in a header template keep their own behaviour.
  • CollectionView.CollectionGroups is now the same collection for as long as the table stays grouped, and it is refilled with one reset instead of one insert per group, so a list bound to it follows regrouping. It is still null while the table is not grouped.
  • While the table is zoomed out, CollectionGroups also lists the subgroups of collapsed groups. Picking one expands the groups it is nested in and scrolls to it. The table shows no header for these entries.
  • Removing the table from the SemanticZoom (its SemanticZoomOwner set back to null) stops the listing of hidden subgroups. A table used as the zoomed-out view never builds them.
  • CollectionGroups entries return their group's key from ToString(), so a list showing them gives screen readers the key as each item's name instead of the type name.
  • TableViewGroupInfo.Level is now public (read-only), so a zoomed-out item template can tell nesting levels apart.
  • ScrollRowIntoView is split into an internal ScrollVisualRowIntoView(visualIndex, alignToTop); its behaviour for existing callers is unchanged.
  • Sample app: two Windows-only pages, Semantic Zoom (one grouping level) and Nested Semantic Zoom (two levels).

Why Windows only

Uno Platform does not implement SemanticZoom: the types exist only as not-implemented stubs, so there is no control for the table to be a view of. It is tracked in unoplatform/uno#5252, and unoplatform/uno#23943 is an open PR that ports it to the Skia targets. Until that lands, the interface and the header tap are compiled under #if WINDOWS and the two sample pages are left out of the Uno sample app. The scrolling and group lookup behind them are platform-neutral and their tests run on Uno, so enabling this on Uno later should mostly mean removing the #if.

Related Issue

None.

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 📝 Documentation update
  • ♻️ Refactor
  • 🧪 Test
  • 🔧 Chore / maintenance

Checklist

  • This PR is not from my main branch
  • Tested with WinUI target
  • Tested with Uno Platform target
  • Unit / integration tests added or updated
  • Documentation updated to reflect changes
  • Code follows the project's coding conventions

Screenshots / Recordings

Semantic Zoom page zoomed out to the group tiles

Zoomed out: the groups of the table as tiles, with one tile hovered.

Semantic Zoom page after picking the Development group

After picking Development: the table zooms back in with that group's header at the top.

Both sample pages were exercised with real mouse input in a JIT build and in a Native AOT publish.

Additional Notes

Tests

  • WinUI suite: 754 passed. Uno desktop suite: 744 passed. Both were run on the branch, which is four commits behind main; CI runs them on the merge.
  • TableViewSemanticZoomTests is new. The scrolling and group lookup tests are shared with Uno; the tests that need a real SemanticZoom are under #if WINDOWS.
  • The header tap itself is not raised in a test. The tests cover the zoom-out it triggers and the check that skips buttons, other focusable controls and hyperlinks.

Performance (1,000,000 rows, two grouping levels, 200 groups with 100 subgroups each, Release, best of 6)

Time
Expand or collapse one group, all groups collapsed, not zoomed out 60-170 ms, the same as before this change
Building the hidden subgroups on zoom-out, all groups collapsed 1.1-1.4 s, once per zoom-out
Rebuild with every group expanded, for comparison 0.9-2.6 s

Hidden subgroups are built only when the table zooms out and are dropped when it zooms back in. Nothing is built when no parent group is collapsed. A table that is not in a SemanticZoom builds its groups as before.

Native AOT

The WinUI sample app was published with Native AOT and both pages work in that build. The library's new code adds no trimming or AOT warnings. Uno targets, including WebAssembly, were not checked under AOT; the interface and the header tap are compiled only for Windows.

Not included

  • A UI Automation equivalent of the header click.
  • A bindable CollectionGroups property on TableView. The zoomed-out view's ItemsSource is assigned in code-behind, because x:Bind cannot observe ICollectionView.CollectionGroups going from null to a collection.

🤖 Generated with Claude Code

w-ahmad and others added 2 commits November 30, 2026 00:43
v2 TableView derives from Control, so it lost the ISemanticZoomInformation
that v1 inherited from ListView. Implement it on Windows (Uno has no
SemanticZoom): picking a group in the other view scrolls its header to the
top, zooming out lands on the group at the top of the viewport, and
clicking a group header zooms out to that group.

- CollectionGroups stays the same collection while the table is grouped
  and is refilled with one reset, so a list bound to it follows regrouping.
- While zoomed out, CollectionGroups also lists the subgroups of collapsed
  groups as hidden entries; picking one expands the groups it is nested in.
  They are built on zoom-out only, so expanding and collapsing while
  zoomed in costs what it did before.
- TableViewGroupInfo.Level is public, to tell nesting levels apart.
- Sample app: Semantic Zoom and Nested Semantic Zoom pages (Windows only).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- Picking an item inside collapsed groups expands them and scrolls to it.
  Lookup order is group entry, then item, then outermost group key.
- A tap on a hyperlink in a header template no longer zooms out.
- A table used as the zoomed-out view no longer builds hidden subgroups.
- Group building takes its output list as a parameter instead of a
  long-lived buffer field; FindCollectionGroup moved into CollectionView.
- Tests unload in finally and unsubscribe their event handler.
- Shorter doc comments; one InsertRange for the two sample pages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@w-ahmad
w-ahmad merged commit c1fa44c into main Nov 30, 2026
16 checks passed
@w-ahmad
w-ahmad deleted the claude/grouping-semantic-zoom-v2-c6c61c branch November 30, 2026 10:04
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