Repository navigation
Add hierarchical rows, context menu and live data samples to TableView - #2283
Conversation
Adds a "Showing hierarchical rows" example to the TableView page. A flat folder/file collection becomes nested rows through TableViewSource.ParentBy(Id, ParentId); the options panel filters by name (matches keep their ancestors) and expands or collapses every row. Requires a Windows App SDK experimental release that includes the TableView hierarchy API (ParentBy, ExpandAllRows/CollapseAllRows). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Give the hierarchy sample's Name column a MinWidth so third-level names aren't truncated by the row indent. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Adding context menus to cells, rows, and headers: a Name column CellContextFlyout, a row menu from an implicit TableViewRow style, one shared HeaderContextFlyout that reads its column from MenuFlyout.Target (hide/show columns), and TableView.ContextFlyout as the fallback. - Updating rows from live data: a DispatcherTimer updates observable items, and TableViewSource.IsLiveShaping keeps the sort and filter current while the selection follows its item. Options pause updates, turn live shaping off, and filter by value. The timer stops on Unloaded. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| @@ -0,0 +1,162 @@ | |||
| --- header | |||
There was a problem hiding this comment.
The snippet here doesn't match the implementation. Similarly for HierarchyTable.txt.
There was a problem hiding this comment.
Fixed in 917d4b9. The HierarchyTable, ContextMenuTable and LiveDataTable snippets now copy the page code as is. Only AutomationIds are left out. I also added a catalog test, SnippetMatchesThePageImplementation, that fails if these snippets stop matching the page.
- Live data: add a Shaping selector (Flat, Grouped by trend, Hierarchy, Grouped hierarchy). Items now have a parent and a Trend group key, so live shaping re-sorts within groups and sibling sets, moves rows between trend groups, and moves top-level rows with their nested rows. - The live table's timer now starts and stops with the table's own Loaded/Unloaded handlers. - HierarchyTable.txt, ContextMenuTable.txt and LiveDataTable.txt now show the page's code verbatim (AutomationIds omitted), including the item classes and Output text, instead of rewritten versions. - Add SnippetMatchesThePageImplementation, which fails if those snippets drift from TableViewPage.xaml, TableViewPage.xaml.cs or the item classes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Added a Shaping option to the live data example with Flat, Grouped by trend, Hierarchy and Grouped hierarchy. With live shaping on, rows re-sort inside their group or parent, move between trend groups as values change, and parent rows keep their child rows when they move. Fixed in 917d4b9. |
|
Nitin Chaudhary (@Nitin-100) CI is failing |
<!--- Provide a general summary of your changes in the Title above --> ## Description <!--- Describe your changes in detail --> - Bump WinUI Gallery to `3.1.0.0` for the next release, keeping the project/assembly version and both package manifests synchronized. - Upgrade Windows App SDK from `2.5.4-experimental` to `2.6.6-experimental`. - Fix the existing TableView header-menu example to use public APIs. Each column owns its header flyout, allowing the opening handler to identify the requested column without referencing the unprojected `TableViewColumnHeader` type. - Update the copyable TableView snippet, catalog, and regression assertions. - Document Chart UI Automation support and add an Appium regression test for its accessible name, help text, axes, series, and six data points. The branch is rebased onto current remote `main`. The TableView hierarchy, context-menu, and live-data examples already landed in #2283, so this PR reuses those examples rather than adding duplicates. Scrolling-overflow examples and tests are excluded entirely. ## Motivation and Context <!--- Why is this change required? What problem does it solve? --> <!--- If it fixes an open issue, please link to the issue here. --> Prepare WinUI Gallery 3.1 and exercise the experimental SDK capabilities in the existing gallery samples. The upstream TableView header handler does not compile against the public 2.6.6 metadata; this change removes that dependency while preserving the column-specific hide/restore menu behavior. Release notes: https://github.com/microsoft/WindowsAppSDK/releases/tag/v2.6.6-exp ## How Has This Been Tested? <!--- Please describe in detail how you tested your changes. --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> Windows, Debug x64, packaged local Gallery, before the version-only follow-up: - `dotnet run --project tools\CatalogExporter -- generate` — passed; regenerated catalog committed. Existing unrelated snippet warnings remain. - `dotnet test tests\WinUIGallery.CatalogExporter.Tests --verbosity quiet` — passed, 172 tests. - `dotnet build WinUIGallery\WinUIGallery.csproj -p:Configuration=Debug -p:Platform=x64 --no-restore --verbosity quiet` — passed; existing nullable/signing-certificate warnings remain. - `dotnet build tests\WinUIGallery.UITests\WinUIGallery.UITests.csproj --verbosity quiet` — passed. - Local `winapp ui` checks — hierarchy expansion/collapse/filtering and live shaping/filter/update toggles exercised repeatedly; Chart axes, series, and all six accessible data points verified. - The Name header menu opened with the correct “Hide Name” command. Full repeated header hide/restore checks and dark-theme verification were blocked by foreground-input safeguards; these are not claimed as passing. - The new Appium test was compiled but not run through Appium/WinAppDriver. A diagnostic app run exited normally without reporting a crash. Version-only follow-up: - `dotnet msbuild WinUIGallery\WinUIGallery.csproj -p:Configuration=Release -p:Platform=x64 -getProperty:Version,AssemblyVersion,AssemblyFileVersion` — passed; all three evaluated properties are `3.1.0.0`. - Parsed both package manifests and verified their identity versions are `3.1.0.0` — passed. - Full Release package builds and Store submission have not been run. ## Screenshots (if appropriate): N/A — this PR upgrades the SDK, bumps the Gallery version, and corrects existing menu wiring; it does not add new sample layouts. ## Types of changes <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [x] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Description
Adds three examples to the TableView page:
1. Showing hierarchical rows
TableViewHierarchyItem, withIdandParentId) is shown as nested rows throughTableViewSource.ParentBy(Id, ParentId). A null parent key makes a top-level row.ExpandAllRows/CollapseAllRows).*expands the focused row's subtree.MinWidth="200"so third-level names aren't truncated by the indent.2. Adding context menus to cells, rows, and headers
Shows how TableView chooses which menu to open:
CellContextFlyoutwith "Copy name".ContextFlyout, set through an implicitTableViewRowstyle (Copy row / Move to next category / Remove).HeaderContextFlyoutshared by all columns. ItsOpeninghandler readsMenuFlyout.Target(TableViewColumnHeader.Column) to offer "Hide " (disabled on the last visible column) and "Show all columns".ContextFlyout("Restore all items") as the fallback.DataContext. Results go to the example's Output.3. Updating rows from live data
DispatcherTimerupdates a few observableTableViewLiveItemvalues every second, and the table is sorted by Value, descending.TableViewSource.IsLiveShaping = truere-applies the sort, filter, grouping, and hierarchy on eachPropertyChanged, so rows move as values change and the selection stays with its row.LoadedandUnloadedevents.Shared
partial, per Fix TableView NullReferenceException in trimmed (Store) builds #2265, so trimmed Store builds keep the CsWinRT vtable.ControlInfoData.json: addshierarchy,tree,context menuandlive datatags, and updates the description.catalog/windows-samples.jsonis regenerated.SnippetMatchesThePageImplementationfails if the three new snippets stop matchingTableViewPage.xaml,TableViewPage.xaml.cs, or the item classes (only AutomationIds are left out of the snippets).TableViewLiveItem(tree shape, update, trend, clamping, notifications).Motivation and Context
Follows #2250 (first set of TableView samples) by covering hierarchical rows, context menus and live data updates, which TableView gained in microsoft/microsoft-ui-xaml after #2250.
Important
Blocked on the next Windows App SDK experimental release.
ParentBy,ExpandAllRows/CollapseAllRows,CellContextFlyout/HeaderContextFlyout, andTableViewSource.IsLiveShapingare not in2.5.4-experimental, so PR validation fails to compile. The stable2.6.4release (27-Oct) doesn't include them either, because TableView ships only in experimental releases. All of these APIs are on the WinUI experimental release branch. This PR deliberately does not changeWindowsAppSdkPackageVersion; the bump will be added when that release ships.How Has This Been Tested?
Windows x64, .NET SDK 10.0.401, against a local build of microsoft-ui-xaml
main(466f4a35cb), referenced on top of2.5.4-experimentalwith command-line-only overrides (no project files in this PR change for that).Hierarchical rows
ExpandCollapsePatternall work.jpgkeeps Pictures → Vacation → the two images, andzzzshows the empty template.*and Left (twice) behave as described.Context menus (opened through UI Automation
ShowContextMenu, the same path Narrator uses for Shift+F10)Live data
Builds and tests
Release-Unpackaged(PublishTrimmed, single file). Hierarchy, all three menu levels, and live updates work with no exception. The only trim warnings are pre-existing ones (ItemPage,WinRT.Runtime).dotnet test tests\WinUIGallery.CatalogExporter.Tests: 172/172 passed.CatalogExporter -- check: index is up to date.WinUIGallery.UnitTests(TableView filter, throughvstest.console): 20/20 passed.Screenshots (if appropriate):
Hierarchical rows. Screenshots of the context menu and live data examples will be added with the package bump.
Types of changes