Repository navigation
Conversation
Reuse the native ListViewBase selection provider and ListView item data peers. Add native UI regression tests for selection identity, provider actions, disabled controls, and collection changes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The tests check only GetSelection() array length, so they could pass even if the returned provider represents the wrong selected item, including after collection changes.
1 open issue
What changed in this PR
This PR adds native selection-aware automation peers to Segmented, addressing the provider-support portion of #192 and #295 without claiming broader Narrator or item-position fixes.
Changes:
- Connects
Segmentedto a list-based automation peer with native item peers. - Adds Windows regression tests for selection providers, disabled selection, and identity after collection changes.
- Documents the selection patterns and accessible naming.
| File | Description |
|---|---|
components/Segmented/tests/Test_Segmented_AutomationPeer.cs |
Adds native selection-provider regression tests. |
components/Segmented/tests/Segmented.Tests.projitems |
Includes the new tests in the shared project. |
components/Segmented/src/Segmented/SegmentedAutomationPeer.cs |
Adds the root peer and native item-peer factory. |
components/Segmented/src/Segmented/Segmented.cs |
Hooks the control into the new automation peer. |
components/Segmented/src/ReadMe.md |
Documents Windows selection support and accessible naming. |
Review effort: Balanced
Resolve the native provider returned by GetSelection and check the expected logical item in every selection assertion, including retained peers after collection changes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
The native UIA tests were only compiled, leaving provider selection, disabled rejection, retained-peer behavior, and compatibility with the minimum supported WinUI 1.8 runtime unverified on Windows.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
Assert UIA_E_ELEMENTNOTENABLED for disabled selection and re-enable before querying selection providers. Reorder unselected items with remove/insert instead of a Move reset, and retain identity assertions for surviving peers after removal. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
Windows runtime validation is still needed for provider selection, disabled rejection, and retained-peer behavior because the added tests remain unexecuted and minimum-supported WinUI 1.8 compatibility is unverified.
No open issues 🎉
Review effort: Balanced
The native WinAppSDK CI job now passes at |
…automation-peers Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
Native UWP runtime validation is still needed because UWP CI discovered no tests, leaving selection-provider behavior unverified, particularly with a named root given the known Narrator crash.
No open issues 🎉
Review effort: Balanced

Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
2caea5b2524753af4074e5031b47655b212fb96b↑ Full CI run 45709808319 passed every build and package job.
↑ Source-matched A/B and both hook mutations behaved as expected in unpackaged consumers.
↓ UWP CI discovered no tests, so UWP runtime behavior is unverified.
↓ Narrator announcements, PositionInSet/SizeOfSet and the named-root crash in #581 are unverified.
↑ Removing the peer hook removed providers, and removing only the item factory made GetSelection throw 0x8000FFFF.
↓ Those issues also mention announcements and item position, which this change does not verify.
Fixes
Addresses the missing selection-provider support reported in #192 and #295. These issues also cover announcements and item-position information, so this PR does not close them or claim those broader contracts are fixed.
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Segmentedderives fromListViewBase, but it does not create a selection-aware automation peer. Its inherited peer exposes neither the root Selection provider nor item SelectionItem providers, even when native selection changes.What is the new behavior?
Segmentedcreates aSegmentedAutomationPeerderived fromListViewBaseAutomationPeer. The peer creates nativeListViewItemDataAutomationPeerinstances for items. Naming, child enumeration, selection, and event behavior stay with the native implementation.The change adds native UI regression cases for string items and explicit containers, named roots, selection identity, provider Select, disabled rejection, and retained item identity after collection changes. The assertions check both the item states and the identity of the provider returned by root Selection. The test file is included explicitly in the shared test project.
PR Checklist
Please check if your PR fulfills the following requirements:
This fixes an existing component. The new-component checklist does not apply.
Other information
Build validation
The production change was validated at
46693f9ae7810dea2f98161d7f5f5157181cfe92, based ona2fa47ad72cb95ed81f3ff0885da627a5fd6c14e, with toolingf02adf9e2d1ec1fd4865116bc786e217298985af. Test-only follow-ups throughc8380aa5f6971c98e75c97d89dffcc504c4641f5were compiled on both native test heads. The unchanged SDK policy selected .NET SDK 10.0.404. Native source builds used the repository's WinUI 1.8.260204000 and CsWinRT 2.2.0 pins.The commands used process-local CLI and NuGet caches. The official NuGet v2 source was supplied only for these restores because the v3 endpoint failed TLS negotiation. No repository feeds, dependency pins, build gates, or global settings changed.
Passed for net8 and net9 Windows 26100.
Passed for the latest test revision. This local command compiled the native MSTest head without executing it. The separate CI execution is recorded below.
Passed for UAP 17763 and net8/net9 Windows 26100 after shortening the private cache path to avoid MAX_PATH.
Passed for the latest test revision after shortening only the generated head's output/intermediate paths to avoid MAX_PATH. Local native MSTest head compilation only, not test execution.
Passed for the declared Uno net9 library target. No Uno runtime test was run.
Native CI validation
The current head
2caea5b2524753af4074e5031b47655b212fb96bmerges main ataf067edcc29e92cb28376aaf54f4cd99c8ac523f, which contains the #893 CI fix. That merge adds only the inheritedbuild.ymlchange, and the component code and tests are unchanged fromc8380aa. The full CI run on this head passed every build job, both package jobs,wasm-linuxandXaml-Style-Check. Sign and release were skipped. The WinAppSDK job on this head again ran all six Segmented tests successfully, with 388 total tests and 3 skipped. The UWP job built successfully but again reported "No test is available in entrypoint\CommunityToolkit.Tests.Uwp.exe", so it is not UWP runtime evidence.Earlier, the WinAppSDK CI job passed on
c8380aa5f6971c98e75c97d89dffcc504c4641f5using the pinned WinUI 1.8.260204000 package. It ran the repository's native test command.Passed. The full component run reported 385 passed and 3 skipped out of 388 tests. All six new Segmented tests passed, including root provider identity,
SelectionItem.Select, disabled-element HRESULT and unchanged selection, and retained peer identity after reorder/removal.On that older head, other matrix jobs failed before compilation during Uno workload installation because the .NET 11 and .NET 10 Mono workload manifests conflicted. This PR did not suppress or bypass those failures. They passed after the #893 fix was merged in, as shown above. The earlier UWP CI job completed successfully, but VSTest reported "No test is available in entrypoint\CommunityToolkit.Tests.Uwp.exe." That is build success, not evidence that the UWP Segmented tests ran.
The shared bootstrap failure was reproduced against main at
a2fa47adby the WASM-only diagnostic in #894. Its additive SDK 10.0.101 candidate passed WASM bootstrap, not full-platform validation. Maintainer repair #893 takes a different approach, removing SDKs newer than the repository-selected SDK on CI runners. #893 has since merged, and the current-head CI result for this PR is listed above.Focused runtime evidence
A standalone diagnostic reproduction is available in microsoft/microsoft-ui-reactor#1650. It demonstrates the gap in the published 8.3.260402-preview2 package and does not contain this native fix. The source-matched candidate and mutation results below are separate evidence.
Source-matched parent and candidate packages were compared in unpackaged consumers with identical resolved dependencies on net10 Windows 26100 and WinUI 2.2.1.
GetSelectionto throw0x8000FFFF. The factory-off native capture stopped at string-item/index 0, so its explicit-container form was not observed.These historical unpackaged runs are focused provider/identity evidence, separate from the newer native CI test results above. OS exit codes and full TAP-lane completion were not captured for those live probes. Narrator announcements, PositionInSet/SizeOfSet, and the named-root UWP/Narrator crash remain unverified. No local Appx/MSIX deployment was performed. This does not claim #193 or #581 is fixed.