Repository navigation
[Windows] Fix doubled CollectionView item spacing - #38960
Conversation
Split linear and grid spacing across adjacent item containers and cover rendered gaps, runtime updates, fractional values, and untemplated items. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Avoid inner TextBlock metrics, context-driven handler replacement, and stale templates after spacing changes. Report measured gaps on failure. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 38960Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 38960" |
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
|
/azp run maui-pr-devicetests |
|
/azp run maui-pr-uitests |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
1 similar comment
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
Windows rendering behavior requires final human validation.
Review effort: Lite
Findings: None
What changed in this PR
Fixes doubled Windows CollectionView spacing by splitting spacing across adjacent item-container sides.
Changes:
- Applies half-spacing to linear and grid layouts.
- Adds Windows regression tests for orientations, grids, fractional values, and live updates.
| File | Description |
|---|---|
src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.Windows.cs |
Adds rendered-spacing regression coverage. |
src/Controls/src/Core/Handlers/Items/StructuredItemsViewHandler.Windows.cs |
Applies half-spacing margins and padding. |
Refresh only the eight baselines whose rendered gaps changed with the spacing fix. Preserve selection, sizing, and swipe behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
/azp run maui-pr-uitests |
|
/azp run maui-pr-devicetests |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
1 similar comment
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
This comment has been minimized.
This comment has been minimized.
|
Note 🔍
|
|
Clarification for the latest review overview: the eight Windows PNG baseline updates are included in commit 2e987fc and are present in this PR's Files changed. They are binary files, so a text-only diff can omit their contents. The runtime fix targets the default Windows The current-head UI rerun is build 1614910. Its result is still pending; the PR description explicitly records the local WinAppDriver blocker rather than claiming local screenshot tests passed. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Note 🔍
|
|
The This is an automation failure, not a verdict on the PR tests. Maintainers can retry |
MauiBot
left a comment
There was a problem hiding this comment.
AI Review Summary
@jfversluis — new AI review results are available based on commit
2e987fc.
🗂️ Review Sessions — click to expand
🚦 Gate — Test Before & After Fix
Gate Result: ⚠️ SKIPPED
No tests were detected in this PR.
Recommendation: Add tests to verify the fix using the write-tests-agent.
📋 Pre-Flight — Context & Validation
PR #38960 Pre-Flight
Context
- PR:
[Windows] Fix doubled CollectionView item spacing - State: Merged into
inflight/currentas6592513435ff97c207df1124749650ba20f10424; reviewed head2e987fc48c76ca4876087e7e25fca8505617e191. - Issue: #38959 reports that
LinearItemsLayout.ItemSpacing="30"renders substantially larger gaps on Windows than Android in .NET MAUI 10.0.110. - Platform: Windows.
Handlers/Items/is the only Windows CollectionView implementation;Items2/has no Windows path. - Gate: Previously skipped with no tests detected. Do not rerun the gate and do not modify
gate/content.md.
Existing PR approach
WinUI receives symmetric spacing on both sides of every item container. Adjacent contributions add, so applying the full requested value to both sides doubles the rendered inter-item gap. The PR changes:
- Grid margins from
(h, v, h, v)to(h / 2, v / 2, h / 2, v / 2). - Vertical linear margins from
(0, v, 0, v)to(0, v / 2, 0, v / 2). - Horizontal linear padding from
(h, 0, h, 0)to(h / 2, 0, h / 2, 0).
The implementation change is four substitutions in:
src/Controls/src/Core/Handlers/Items/StructuredItemsViewHandler.Windows.cs
The PR also adds 201 lines of Windows device coverage and updates eight Windows UI snapshots. No public API is changed.
Required alternative-fix distinction
Candidates must not repeat the PR's split the requested spacing equally across both symmetric sides mechanism. A different line, helper, or call site that still divides every symmetric contribution by two is the same approach. Each candidate must use a different root-cause hypothesis or spacing mechanism and explain the causal distinction.
Narrow validation surface
Use only the Windows Controls device-test runner and the PR's ten spacing cases:
LinearItemSpacingMatchesRenderedGap(6 theory cases)GridItemSpacingMatchesRenderedGap(2 theory cases)UntemplatedLinearItemSpacingIsSharedBetweenAdjacentContainers(2 theory cases)
The tests cover zero, fractional, and nonzero values; vertical and horizontal linear layouts; both grid orientations and axes; live spacing updates; and untemplated style mapping. Do not run a full test suite. The aggregate test command supplied to each attempt must remain scoped to these cases.
Relevant changed files
src/Controls/src/Core/Handlers/Items/StructuredItemsViewHandler.Windows.cssrc/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.Windows.cs- Eight Windows CollectionView snapshot PNGs under
src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/
Constraints for attempts
- One implementation/test pass and at most one focused correction/retest.
- Use
EstablishBrokenBaseline.ps1and itsRevertedFilesallow-list exactly as required by thetry-fixskill. - Perform the skill's expert review inline; do not launch
maui-expert-revieweror any other reviewer. - Restore exclusively with
pwsh .github/scripts/EstablishBrokenBaseline.ps1 -Restore. - Persist the candidate narrative and aggregate before any later candidate begins.
🔬 Code Review — Deep Analysis
Code Review — PR #38960
Independent Assessment
What this changes: The Windows CollectionView handler now applies half of each requested spacing value to each symmetric side of adjacent item containers. Grid layouts use half horizontal and vertical margins, vertical linear layouts use half top/bottom margins, and horizontal linear layouts use half left/right padding. The PR also adds Windows device coverage for linear and grid orientations, zero/fractional/nonzero spacing, live updates, and untemplated style mapping, and updates eight Windows snapshots.
Inferred motivation: WinUI adds the full contributions from adjacent containers, so assigning the requested spacing to both symmetric sides produces a rendered gap twice as large as requested.
Reconciliation with PR Narrative
The submitted implementation matches the stated root cause and correction. The half-side contributions preserve the existing symmetric edge-spacing strategy while making each adjacent pair sum to the requested spacing.
Prior Review Reconciliation
No prior error-level findings were found on the available top-level review, inline review-comment, or PR issue-comment surfaces.
Blast Radius Assessment
- Runs for all instances: Yes, for Windows
CollectionViewinstances using the only Windows handler inHandlers/Items. - Startup impact: None; the changed arithmetic runs while constructing/updating native item-container styles.
- Static/shared state: No new state was added. Existing cached styles remain, with only their spacing values changed.
- Public API: None.
CI / Gate Evidence
- Gate result: Skipped — no tests detected in this PR.
- Required checks: Could not be queried because GitHub CLI authentication is unavailable.
- Review consequence: Evidence remains undetermined, so confidence is capped at low and the expert verdict cannot be
LGTMunder the code-review policy.
Findings
No actionable inline code findings. inline-findings.json contains an empty JSON array.
Failure-Mode Probing
- Fractional spacing remains representable as
double; the device tests allow the expected one-DIP layout-rounding tolerance. - Negative spacing is rejected by the existing bindable-property validation before reaching the handler; this change does not introduce a new nonfinite path.
- Existing layout-property change handling reapplies spacing, and the added tests cover live linear and grid updates.
- Both linear orientations, both grid orientations, and the untemplated style path are covered.
- No subscriptions, async work, handler lifecycle transitions, or shared-state semantics changed.
External Output Contract
Not applicable.
Verdict: NEEDS_DISCUSSION
Confidence: low
Summary: The submitted code and focused regression tests form a coherent fix, and the expert review found no actionable code changes to apply. The verdict is limited only by the skipped gate and unavailable required-check evidence, not by an identified implementation defect.
🛠️ Try-Fix — Analysis & Comparison
Try-Fix Candidate 1 (PR #38960)
Approach: Single-side boundary ownership for item spacing (hypothesis only; no tracked code edits applied due baseline guard).
Prior PR approach avoided and mechanism-level difference: The existing PR halves symmetric spacing values on both adjacent containers (Grid margins, vertical linear margins, horizontal linear padding). This candidate uses a different root-cause model: doubled gaps occur because both neighbors own the same boundary. The alternative mechanism assigns each inter-item boundary to one owner side/container so the full requested spacing is contributed once, avoiding additive doubling without per-side division.
Files changed: None.
Result: Blocked
Exact test command:
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform windows -Rebuild -TestFilter "Category=CollectionView" -IncludeClasses "Microsoft.Maui.DeviceTests.CollectionViewTests" -IncludeMethods "LinearItemSpacingMatchesRenderedGap,GridItemSpacingMatchesRenderedGap,UntemplatedLinearItemSpacingIsSharedBetweenAdjacentContainers" -Timeout "00:20:00" -OutputDirectory "CustomAgentLogsTmp\PRState\38960\PRAgent\try-fix\attempt-1\device-test-output"
Test results: Not executed. EstablishBrokenBaseline failed with "No fix files detected" and .github/.baseline-state.json was absent.
Inline self-review count: 0 findings.
Failure analysis: Baseline allow-list state was unavailable, so try-fix safety rules required Blocked before tracked edits or test execution.
Complete candidate diff (from fix.diff):
(no diff)
Try-Fix Candidate 2 (PR #38960)
Approach: Panel-owned layout spacing (hypothesis only; no tracked code edits applied due the baseline guard). The intended mechanism removes item-spacing geometry from GridViewItem/ListViewItem margins and padding, then has the Windows items panel advance between consecutive child layout slots by exactly the requested horizontal or vertical spacing.
PR and candidate-1 approaches avoided and mechanism-level difference: The existing PR divides Grid horizontal/vertical margins, vertical-linear top/bottom margins, and horizontal-linear left/right padding by two, so two symmetric half-contributions add to the requested gap. Candidate 1 instead assigns each boundary to one side/container, which contributes the full requested gap once. Candidate 2 uses neither mechanism: containers contribute zero spacing, no side or container owns an inter-item boundary, and no spacing value is divided. Its distinct root-cause hypothesis is that spacing belongs to the panel's child-placement algorithm rather than the container box model; because the panel computes each next origin from the prior child extent plus one explicit spacing term, adjacent container decorations cannot add and double the gap.
Files changed: None.
Result: Blocked
Exact test command:
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform windows -Rebuild -TestFilter "Category=CollectionView" -IncludeClasses "Microsoft.Maui.DeviceTests.CollectionViewTests" -IncludeMethods "LinearItemSpacingMatchesRenderedGap,GridItemSpacingMatchesRenderedGap,UntemplatedLinearItemSpacingIsSharedBetweenAdjacentContainers" -Timeout "00:20:00" -OutputDirectory "CustomAgentLogsTmp\PRState\38960\PRAgent\try-fix\attempt-2\device-test-output"Test results: Not executed; 0 of the 10 mandatory regression cases ran. EstablishBrokenBaseline.ps1 failed with No fix files detected, emitted no Baseline established marker, and did not create .github.baseline-state.json. The baseline-file boundary therefore required Blocked before tracked edits or device-test execution. No substitute or broader tests were run.
Inline self-review count: 0 findings. The final diff was empty; the expert-review principles, routed Windows CollectionView/native-default guidance, and always-active Logic and Correctness, Regression Prevention, and Complexity Reduction dimensions were reviewed inline.
Failure analysis: The missing baseline state provided no RevertedFiles modification allow-list, so the proposed panel-owned spacing mechanism could not be implemented or empirically evaluated safely. Branches and remote-tracking refs were not manipulated. The mandatory restore command completed with No baseline state found / Restored False, which is the expected no-state completion because no attempt edits were made.
Complete candidate diff (from fix.diff):
(no diff)🏁 Report — Final Recommendation
⚠️ Final Recommendation: REQUEST CHANGES
Winning candidate
Winner: pr
The submitted PR is the only complete, focused implementation. Its symmetric half-spacing mechanism directly corrects the additive WinUI container geometry while preserving the existing style-based layout model, and the single expert review found no actionable code defect. pr-plus-reviewer is byte-for-byte unchanged from its immutable baseline because the reviewer requested no refinement, so it provides no improvement over pr.
Candidate comparison
| Rank | Candidate | Implementation | Regression evidence | Review assessment |
|---|---|---|---|---|
| 1 | pr |
Complete four-substitution handler fix, ten focused Windows device cases, and eight updated Windows snapshots | The submitted PR metadata reports A/B failure-before/pass-after coverage and current-head Windows device/UI passes; the trusted Gate for this run nevertheless reported SKIPPED — no tests detected | No actionable expert finding; best balance of correctness, scope, and compatibility |
| 2 | pr-plus-reviewer |
No reviewer patch; behavior is identical to pr |
No additional run was warranted because no candidate code changed | Valid but strictly redundant, so it cannot displace the raw PR |
| 3 | try-fix-1 |
Single-side boundary ownership was only a hypothesis; no diff exists | Blocked before execution; 0 required cases ran | Cannot establish correctness, recycling/edge behavior, or an advantage over the submitted fix |
| 4 | try-fix-2 |
Panel-owned spacing was only a hypothesis; no diff exists | Blocked before execution; 0 required cases ran | Larger conceptual blast radius with no implementation or empirical result |
No candidate recorded a regression-test failure. The ordering instead places the implemented candidate with reported focused pass evidence above candidates whose regression tests never ran, as required.
Comparative reasoning
- Correctness: Each adjacent pair receives
S / 2 + S / 2 = Sin the existing WinUI box model. The added tests cover vertical/horizontal linear layouts, both grid orientations and axes, zero/fractional/nonzero values, live updates, and the untemplated style path. - Compatibility: The raw PR retains symmetric outer-edge spacing and native style inheritance. A one-sided owner would need additional first/last-item, orientation, RTL, and recycling rules; none were implemented or tested.
- Complexity: Moving spacing into panel child placement would replace the existing container-style mechanism and expand the affected layout surface. Candidate 2 supplied neither code nor evidence to justify that risk.
- Reviewer refinement: The expert produced
[]ininline-findings.json; applying a change merely to create a distinct candidate would reduce confidence rather than improve the fix.
Why this is not an approval
The raw PR wins the implementation comparison, but the hard approval conditions are not met: the trusted Gate was skipped and the expert verdict is NEEDS_DISCUSSION with low confidence because required-check evidence was unavailable. No code change was identified; the blocking gap is verification/test-detection evidence. Approval should wait until that evidence is recognized by the trusted gate or otherwise supplied through the required pipeline.
📱 UI Tests — CollectionView
Detected UI test categories: CollectionView
[!WARNING]
No UI test results were produced for the detected categories. The trusted gate was
skipped before build/test verification, so it does not prove that the PR build is healthy.
The deep UI stage also returned no results; inspect the independent CI checks and retry the
review if those categories still need coverage.
🧭 Next Steps — review latest findings
No alternative fix was selected for this run. Review the session findings and CI results before merging.
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change Windows CollectionView applied the full requested spacing to both sides of each item container. Adjacent margins/paddings add, so `ItemSpacing="30"` produced a **60-DIP gap**, not 30. Split the requested spacing evenly between the two contributing sides in `StructuredItemsViewHandler.Windows.cs`: - Vertical linear layouts: top/bottom margins. - Horizontal linear layouts: left/right padding. - Grid layouts: horizontal/vertical margins. For any finite spacing `S`, the adjacent contributions become `S/2 + S/2 = S`. This is not a DPI correction: WinUI handles scaling of these logical units. Default zero spacing, the existing symmetric edge-spacing approach, and native style inheritance are retained. Applications compensating for the doubled spacing will need to remove that workaround. This changes the default Windows CollectionView handler, not the opt-in obsolete compatibility renderer. ### Empirical before/after evidence The issue's XAML scenario was reproduced in the Sandbox against repository sources on Windows ARM64. These are actual WinUI-rendered page captures, not mockups. Native item bounds were measured after layout. | Before: requested 30, measured 60 DIPs | After: requested 30, measured 30 DIPs | |---|---| |  |  | Item dimensions stayed **300 × 40 DIPs**. Before, item Y positions were `30, 130, 230, 330, 430, 530, 630`; after, `15, 85, 155, 225, 295, 365, 435`. All six adjacent gaps changed from 60 to 30 DIPs. Additional runtime sampling completed **20 captures with zero geometry-check failures**, including both linear orientations, both grid orientations, and changing spacing back to zero: | Requested linear spacing | Measured vertical gap | Measured horizontal gap | |---:|---:|---:| | 0 | 0 | 0 | | 10 | 10 | 10 | | 30 | 30 | 30 | | 7.5 | 8 | 8 | | 0 after updates | 0 | 0 | All captures recorded `XamlRoot.RasterizationScale = 1.0` and layout rounding enabled. The fractional result is **8**, not exactly 7.5, due to pixel snapping. No other display scale was empirically tested, and no OS scaling settings were changed. Grid native-container gaps measured `30/10` for requested horizontal/vertical spacing `30/10`, in both orientations. Fixed-size content centered inside a larger grid cell can have additional whitespace; that is distinct from inter-container spacing. ### Regression coverage and verification Windows device tests cover rendered linear gaps at zero, fractional, and nonzero spacing; both grid axes/orientations; live spacing changes; and untemplated style mapping. The tests measure the current realized native view wrappers, reacquiring them when a style update replaces item templates. The repository's full A/B verification runner completed with **`VERIFICATION PASSED`**: - Original framework code: **10 failed, 0 passed** targeted cases. - Fixed framework code: **10 passed, 0 failed** targeted cases. The fix and tests were reviewed independently with GPT-5.3-Codex and GPT-5.6 Sol. Feedback was addressed, and final reviews reported no remaining actionable findings. The subsequent [independent Windows review](#38960 (review)) on head `2e987fc48c` also reproduced **10 failures without the fix and 10 passes with it**, with no actionable code-review findings. That review's own UI stage produced no results; screenshot verification below comes from the separate public UI pipeline. ### Windows UI baseline updates The initial [UI build 1614797](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614797) exposed eight snapshots that encoded the old doubled spacing. Only those eight Windows baselines were updated from inspected CI captures. Item sizes, selection indicators, and closed swipe states are preserved; the changed gutters and resulting content positions reflect the corrected spacing. For example, `CVHorizontalLinearItemsLayoutItemSpacing` retains identical item widths while all five measured gaps change from 20 to the requested 10 pixels. [Device build 1614798](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614798), on the preceding code-identical head `5ee75080b0`, passed all ten new Windows regression cases. Its packaged and unpackaged Windows CollectionView result files each report **50 passed, 0 failed, 1 known skip**. After the snapshot updates, a fresh local device run also passed all ten targeted cases (full CollectionView results: 50 passed, 0 failed, 1 skipped). The current-head [device build 1614911](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614911) confirmed those same packaged and unpackaged Windows results, including all ten new regression cases. Local Appium screenshot verification was blocked by WinAppDriver's `/status` returning HTTP 500, so none of the eight UI methods ran locally. **All eight updated screenshot tests passed in [UI build 1614910](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614910)**, verified from their actual per-test results: `CVHorizontalLinearItemsLayoutItemSpacing`, `CollectionViewHeightIsCorrectAfterDelayedLoad`, `CollectionViewPreSelectionShouldUpdate`, `CollectionViewSelectionModeOnLightTheme`, `Issue23377ItemSpacing`, `OnlyManuallySwipedItemShouldBeOpened`, `VerifyCVBackgroundAndBackgroundColorWithVSM`, and `VerticalItemsRemainFullyVisibleAfterChangingSpacing`. These are CI screenshot passes, not an inference from the device tests. ### Build artifacts and CI scope [Main build 1614908](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614908) completed successfully. Its **PackageArtifacts** archive contains `Microsoft.Maui.Controls` and `Microsoft.Maui.Controls.Core` version **`10.0.120-ci.pr38960.26478.60`**, including the Windows framework assemblies. Follow [Testing PR Builds](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) to try these packages. The broader device and UI pipelines are **not all green**. Their non-Windows failures and timed-out retries are tracked separately from the verified Windows spacing results; the targeted passes above do not imply whole-suite success. ### Related work After developing this fix independently, I checked for existing fixes. #38367 addresses a different untemplated-grid stretching issue in the .NET 11 handler; it does not correct these additive margins/paddings in the current Windows handler. ### Issues Fixed Fixes #38959 --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change Windows CollectionView applied the full requested spacing to both sides of each item container. Adjacent margins/paddings add, so `ItemSpacing="30"` produced a **60-DIP gap**, not 30. Split the requested spacing evenly between the two contributing sides in `StructuredItemsViewHandler.Windows.cs`: - Vertical linear layouts: top/bottom margins. - Horizontal linear layouts: left/right padding. - Grid layouts: horizontal/vertical margins. For any finite spacing `S`, the adjacent contributions become `S/2 + S/2 = S`. This is not a DPI correction: WinUI handles scaling of these logical units. Default zero spacing, the existing symmetric edge-spacing approach, and native style inheritance are retained. Applications compensating for the doubled spacing will need to remove that workaround. This changes the default Windows CollectionView handler, not the opt-in obsolete compatibility renderer. ### Empirical before/after evidence The issue's XAML scenario was reproduced in the Sandbox against repository sources on Windows ARM64. These are actual WinUI-rendered page captures, not mockups. Native item bounds were measured after layout. | Before: requested 30, measured 60 DIPs | After: requested 30, measured 30 DIPs | |---|---| |  |  | Item dimensions stayed **300 × 40 DIPs**. Before, item Y positions were `30, 130, 230, 330, 430, 530, 630`; after, `15, 85, 155, 225, 295, 365, 435`. All six adjacent gaps changed from 60 to 30 DIPs. Additional runtime sampling completed **20 captures with zero geometry-check failures**, including both linear orientations, both grid orientations, and changing spacing back to zero: | Requested linear spacing | Measured vertical gap | Measured horizontal gap | |---:|---:|---:| | 0 | 0 | 0 | | 10 | 10 | 10 | | 30 | 30 | 30 | | 7.5 | 8 | 8 | | 0 after updates | 0 | 0 | All captures recorded `XamlRoot.RasterizationScale = 1.0` and layout rounding enabled. The fractional result is **8**, not exactly 7.5, due to pixel snapping. No other display scale was empirically tested, and no OS scaling settings were changed. Grid native-container gaps measured `30/10` for requested horizontal/vertical spacing `30/10`, in both orientations. Fixed-size content centered inside a larger grid cell can have additional whitespace; that is distinct from inter-container spacing. ### Regression coverage and verification Windows device tests cover rendered linear gaps at zero, fractional, and nonzero spacing; both grid axes/orientations; live spacing changes; and untemplated style mapping. The tests measure the current realized native view wrappers, reacquiring them when a style update replaces item templates. The repository's full A/B verification runner completed with **`VERIFICATION PASSED`**: - Original framework code: **10 failed, 0 passed** targeted cases. - Fixed framework code: **10 passed, 0 failed** targeted cases. The fix and tests were reviewed independently with GPT-5.3-Codex and GPT-5.6 Sol. Feedback was addressed, and final reviews reported no remaining actionable findings. The subsequent [independent Windows review](#38960 (review)) on head `2e987fc48c` also reproduced **10 failures without the fix and 10 passes with it**, with no actionable code-review findings. That review's own UI stage produced no results; screenshot verification below comes from the separate public UI pipeline. ### Windows UI baseline updates The initial [UI build 1614797](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614797) exposed eight snapshots that encoded the old doubled spacing. Only those eight Windows baselines were updated from inspected CI captures. Item sizes, selection indicators, and closed swipe states are preserved; the changed gutters and resulting content positions reflect the corrected spacing. For example, `CVHorizontalLinearItemsLayoutItemSpacing` retains identical item widths while all five measured gaps change from 20 to the requested 10 pixels. [Device build 1614798](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614798), on the preceding code-identical head `5ee75080b0`, passed all ten new Windows regression cases. Its packaged and unpackaged Windows CollectionView result files each report **50 passed, 0 failed, 1 known skip**. After the snapshot updates, a fresh local device run also passed all ten targeted cases (full CollectionView results: 50 passed, 0 failed, 1 skipped). The current-head [device build 1614911](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614911) confirmed those same packaged and unpackaged Windows results, including all ten new regression cases. Local Appium screenshot verification was blocked by WinAppDriver's `/status` returning HTTP 500, so none of the eight UI methods ran locally. **All eight updated screenshot tests passed in [UI build 1614910](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614910)**, verified from their actual per-test results: `CVHorizontalLinearItemsLayoutItemSpacing`, `CollectionViewHeightIsCorrectAfterDelayedLoad`, `CollectionViewPreSelectionShouldUpdate`, `CollectionViewSelectionModeOnLightTheme`, `Issue23377ItemSpacing`, `OnlyManuallySwipedItemShouldBeOpened`, `VerifyCVBackgroundAndBackgroundColorWithVSM`, and `VerticalItemsRemainFullyVisibleAfterChangingSpacing`. These are CI screenshot passes, not an inference from the device tests. ### Build artifacts and CI scope [Main build 1614908](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614908) completed successfully. Its **PackageArtifacts** archive contains `Microsoft.Maui.Controls` and `Microsoft.Maui.Controls.Core` version **`10.0.120-ci.pr38960.26478.60`**, including the Windows framework assemblies. Follow [Testing PR Builds](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) to try these packages. The broader device and UI pipelines are **not all green**. Their non-Windows failures and timed-out retries are tracked separately from the verified Windows spacing results; the targeted passes above do not imply whole-suite success. ### Related work After developing this fix independently, I checked for existing fixes. #38367 addresses a different untemplated-grid stretching issue in the .NET 11 handler; it does not correct these additive margins/paddings in the current Windows handler. ### Issues Fixed Fixes #38959 --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change Windows CollectionView applied the full requested spacing to both sides of each item container. Adjacent margins/paddings add, so `ItemSpacing="30"` produced a **60-DIP gap**, not 30. Split the requested spacing evenly between the two contributing sides in `StructuredItemsViewHandler.Windows.cs`: - Vertical linear layouts: top/bottom margins. - Horizontal linear layouts: left/right padding. - Grid layouts: horizontal/vertical margins. For any finite spacing `S`, the adjacent contributions become `S/2 + S/2 = S`. This is not a DPI correction: WinUI handles scaling of these logical units. Default zero spacing, the existing symmetric edge-spacing approach, and native style inheritance are retained. Applications compensating for the doubled spacing will need to remove that workaround. This changes the default Windows CollectionView handler, not the opt-in obsolete compatibility renderer. ### Empirical before/after evidence The issue's XAML scenario was reproduced in the Sandbox against repository sources on Windows ARM64. These are actual WinUI-rendered page captures, not mockups. Native item bounds were measured after layout. | Before: requested 30, measured 60 DIPs | After: requested 30, measured 30 DIPs | |---|---| |  |  | Item dimensions stayed **300 × 40 DIPs**. Before, item Y positions were `30, 130, 230, 330, 430, 530, 630`; after, `15, 85, 155, 225, 295, 365, 435`. All six adjacent gaps changed from 60 to 30 DIPs. Additional runtime sampling completed **20 captures with zero geometry-check failures**, including both linear orientations, both grid orientations, and changing spacing back to zero: | Requested linear spacing | Measured vertical gap | Measured horizontal gap | |---:|---:|---:| | 0 | 0 | 0 | | 10 | 10 | 10 | | 30 | 30 | 30 | | 7.5 | 8 | 8 | | 0 after updates | 0 | 0 | All captures recorded `XamlRoot.RasterizationScale = 1.0` and layout rounding enabled. The fractional result is **8**, not exactly 7.5, due to pixel snapping. No other display scale was empirically tested, and no OS scaling settings were changed. Grid native-container gaps measured `30/10` for requested horizontal/vertical spacing `30/10`, in both orientations. Fixed-size content centered inside a larger grid cell can have additional whitespace; that is distinct from inter-container spacing. ### Regression coverage and verification Windows device tests cover rendered linear gaps at zero, fractional, and nonzero spacing; both grid axes/orientations; live spacing changes; and untemplated style mapping. The tests measure the current realized native view wrappers, reacquiring them when a style update replaces item templates. The repository's full A/B verification runner completed with **`VERIFICATION PASSED`**: - Original framework code: **10 failed, 0 passed** targeted cases. - Fixed framework code: **10 passed, 0 failed** targeted cases. The fix and tests were reviewed independently with GPT-5.3-Codex and GPT-5.6 Sol. Feedback was addressed, and final reviews reported no remaining actionable findings. The subsequent [independent Windows review](#38960 (review)) on head `2e987fc48c` also reproduced **10 failures without the fix and 10 passes with it**, with no actionable code-review findings. That review's own UI stage produced no results; screenshot verification below comes from the separate public UI pipeline. ### Windows UI baseline updates The initial [UI build 1614797](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614797) exposed eight snapshots that encoded the old doubled spacing. Only those eight Windows baselines were updated from inspected CI captures. Item sizes, selection indicators, and closed swipe states are preserved; the changed gutters and resulting content positions reflect the corrected spacing. For example, `CVHorizontalLinearItemsLayoutItemSpacing` retains identical item widths while all five measured gaps change from 20 to the requested 10 pixels. [Device build 1614798](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614798), on the preceding code-identical head `5ee75080b0`, passed all ten new Windows regression cases. Its packaged and unpackaged Windows CollectionView result files each report **50 passed, 0 failed, 1 known skip**. After the snapshot updates, a fresh local device run also passed all ten targeted cases (full CollectionView results: 50 passed, 0 failed, 1 skipped). The current-head [device build 1614911](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614911) confirmed those same packaged and unpackaged Windows results, including all ten new regression cases. Local Appium screenshot verification was blocked by WinAppDriver's `/status` returning HTTP 500, so none of the eight UI methods ran locally. **All eight updated screenshot tests passed in [UI build 1614910](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614910)**, verified from their actual per-test results: `CVHorizontalLinearItemsLayoutItemSpacing`, `CollectionViewHeightIsCorrectAfterDelayedLoad`, `CollectionViewPreSelectionShouldUpdate`, `CollectionViewSelectionModeOnLightTheme`, `Issue23377ItemSpacing`, `OnlyManuallySwipedItemShouldBeOpened`, `VerifyCVBackgroundAndBackgroundColorWithVSM`, and `VerticalItemsRemainFullyVisibleAfterChangingSpacing`. These are CI screenshot passes, not an inference from the device tests. ### Build artifacts and CI scope [Main build 1614908](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614908) completed successfully. Its **PackageArtifacts** archive contains `Microsoft.Maui.Controls` and `Microsoft.Maui.Controls.Core` version **`10.0.120-ci.pr38960.26478.60`**, including the Windows framework assemblies. Follow [Testing PR Builds](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) to try these packages. The broader device and UI pipelines are **not all green**. Their non-Windows failures and timed-out retries are tracked separately from the verified Windows spacing results; the targeted passes above do not imply whole-suite success. ### Related work After developing this fix independently, I checked for existing fixes. #38367 addresses a different untemplated-grid stretching issue in the .NET 11 handler; it does not correct these additive margins/paddings in the current Windows handler. ### Issues Fixed Fixes #38959 --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change Windows CollectionView applied the full requested spacing to both sides of each item container. Adjacent margins/paddings add, so `ItemSpacing="30"` produced a **60-DIP gap**, not 30. Split the requested spacing evenly between the two contributing sides in `StructuredItemsViewHandler.Windows.cs`: - Vertical linear layouts: top/bottom margins. - Horizontal linear layouts: left/right padding. - Grid layouts: horizontal/vertical margins. For any finite spacing `S`, the adjacent contributions become `S/2 + S/2 = S`. This is not a DPI correction: WinUI handles scaling of these logical units. Default zero spacing, the existing symmetric edge-spacing approach, and native style inheritance are retained. Applications compensating for the doubled spacing will need to remove that workaround. This changes the default Windows CollectionView handler, not the opt-in obsolete compatibility renderer. ### Empirical before/after evidence The issue's XAML scenario was reproduced in the Sandbox against repository sources on Windows ARM64. These are actual WinUI-rendered page captures, not mockups. Native item bounds were measured after layout. | Before: requested 30, measured 60 DIPs | After: requested 30, measured 30 DIPs | |---|---| |  |  | Item dimensions stayed **300 × 40 DIPs**. Before, item Y positions were `30, 130, 230, 330, 430, 530, 630`; after, `15, 85, 155, 225, 295, 365, 435`. All six adjacent gaps changed from 60 to 30 DIPs. Additional runtime sampling completed **20 captures with zero geometry-check failures**, including both linear orientations, both grid orientations, and changing spacing back to zero: | Requested linear spacing | Measured vertical gap | Measured horizontal gap | |---:|---:|---:| | 0 | 0 | 0 | | 10 | 10 | 10 | | 30 | 30 | 30 | | 7.5 | 8 | 8 | | 0 after updates | 0 | 0 | All captures recorded `XamlRoot.RasterizationScale = 1.0` and layout rounding enabled. The fractional result is **8**, not exactly 7.5, due to pixel snapping. No other display scale was empirically tested, and no OS scaling settings were changed. Grid native-container gaps measured `30/10` for requested horizontal/vertical spacing `30/10`, in both orientations. Fixed-size content centered inside a larger grid cell can have additional whitespace; that is distinct from inter-container spacing. ### Regression coverage and verification Windows device tests cover rendered linear gaps at zero, fractional, and nonzero spacing; both grid axes/orientations; live spacing changes; and untemplated style mapping. The tests measure the current realized native view wrappers, reacquiring them when a style update replaces item templates. The repository's full A/B verification runner completed with **`VERIFICATION PASSED`**: - Original framework code: **10 failed, 0 passed** targeted cases. - Fixed framework code: **10 passed, 0 failed** targeted cases. The fix and tests were reviewed independently with GPT-5.3-Codex and GPT-5.6 Sol. Feedback was addressed, and final reviews reported no remaining actionable findings. The subsequent [independent Windows review](#38960 (review)) on head `2e987fc48c` also reproduced **10 failures without the fix and 10 passes with it**, with no actionable code-review findings. That review's own UI stage produced no results; screenshot verification below comes from the separate public UI pipeline. ### Windows UI baseline updates The initial [UI build 1614797](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614797) exposed eight snapshots that encoded the old doubled spacing. Only those eight Windows baselines were updated from inspected CI captures. Item sizes, selection indicators, and closed swipe states are preserved; the changed gutters and resulting content positions reflect the corrected spacing. For example, `CVHorizontalLinearItemsLayoutItemSpacing` retains identical item widths while all five measured gaps change from 20 to the requested 10 pixels. [Device build 1614798](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614798), on the preceding code-identical head `5ee75080b0`, passed all ten new Windows regression cases. Its packaged and unpackaged Windows CollectionView result files each report **50 passed, 0 failed, 1 known skip**. After the snapshot updates, a fresh local device run also passed all ten targeted cases (full CollectionView results: 50 passed, 0 failed, 1 skipped). The current-head [device build 1614911](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614911) confirmed those same packaged and unpackaged Windows results, including all ten new regression cases. Local Appium screenshot verification was blocked by WinAppDriver's `/status` returning HTTP 500, so none of the eight UI methods ran locally. **All eight updated screenshot tests passed in [UI build 1614910](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614910)**, verified from their actual per-test results: `CVHorizontalLinearItemsLayoutItemSpacing`, `CollectionViewHeightIsCorrectAfterDelayedLoad`, `CollectionViewPreSelectionShouldUpdate`, `CollectionViewSelectionModeOnLightTheme`, `Issue23377ItemSpacing`, `OnlyManuallySwipedItemShouldBeOpened`, `VerifyCVBackgroundAndBackgroundColorWithVSM`, and `VerticalItemsRemainFullyVisibleAfterChangingSpacing`. These are CI screenshot passes, not an inference from the device tests. ### Build artifacts and CI scope [Main build 1614908](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614908) completed successfully. Its **PackageArtifacts** archive contains `Microsoft.Maui.Controls` and `Microsoft.Maui.Controls.Core` version **`10.0.120-ci.pr38960.26478.60`**, including the Windows framework assemblies. Follow [Testing PR Builds](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) to try these packages. The broader device and UI pipelines are **not all green**. Their non-Windows failures and timed-out retries are tracked separately from the verified Windows spacing results; the targeted passes above do not imply whole-suite success. ### Related work After developing this fix independently, I checked for existing fixes. #38367 addresses a different untemplated-grid stretching issue in the .NET 11 handler; it does not correct these additive margins/paddings in the current Windows handler. ### Issues Fixed Fixes #38959 --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change Windows CollectionView applied the full requested spacing to both sides of each item container. Adjacent margins/paddings add, so `ItemSpacing="30"` produced a **60-DIP gap**, not 30. Split the requested spacing evenly between the two contributing sides in `StructuredItemsViewHandler.Windows.cs`: - Vertical linear layouts: top/bottom margins. - Horizontal linear layouts: left/right padding. - Grid layouts: horizontal/vertical margins. For any finite spacing `S`, the adjacent contributions become `S/2 + S/2 = S`. This is not a DPI correction: WinUI handles scaling of these logical units. Default zero spacing, the existing symmetric edge-spacing approach, and native style inheritance are retained. Applications compensating for the doubled spacing will need to remove that workaround. This changes the default Windows CollectionView handler, not the opt-in obsolete compatibility renderer. ### Empirical before/after evidence The issue's XAML scenario was reproduced in the Sandbox against repository sources on Windows ARM64. These are actual WinUI-rendered page captures, not mockups. Native item bounds were measured after layout. | Before: requested 30, measured 60 DIPs | After: requested 30, measured 30 DIPs | |---|---| |  |  | Item dimensions stayed **300 × 40 DIPs**. Before, item Y positions were `30, 130, 230, 330, 430, 530, 630`; after, `15, 85, 155, 225, 295, 365, 435`. All six adjacent gaps changed from 60 to 30 DIPs. Additional runtime sampling completed **20 captures with zero geometry-check failures**, including both linear orientations, both grid orientations, and changing spacing back to zero: | Requested linear spacing | Measured vertical gap | Measured horizontal gap | |---:|---:|---:| | 0 | 0 | 0 | | 10 | 10 | 10 | | 30 | 30 | 30 | | 7.5 | 8 | 8 | | 0 after updates | 0 | 0 | All captures recorded `XamlRoot.RasterizationScale = 1.0` and layout rounding enabled. The fractional result is **8**, not exactly 7.5, due to pixel snapping. No other display scale was empirically tested, and no OS scaling settings were changed. Grid native-container gaps measured `30/10` for requested horizontal/vertical spacing `30/10`, in both orientations. Fixed-size content centered inside a larger grid cell can have additional whitespace; that is distinct from inter-container spacing. ### Regression coverage and verification Windows device tests cover rendered linear gaps at zero, fractional, and nonzero spacing; both grid axes/orientations; live spacing changes; and untemplated style mapping. The tests measure the current realized native view wrappers, reacquiring them when a style update replaces item templates. The repository's full A/B verification runner completed with **`VERIFICATION PASSED`**: - Original framework code: **10 failed, 0 passed** targeted cases. - Fixed framework code: **10 passed, 0 failed** targeted cases. The fix and tests were reviewed independently with GPT-5.3-Codex and GPT-5.6 Sol. Feedback was addressed, and final reviews reported no remaining actionable findings. The subsequent [independent Windows review](#38960 (review)) on head `2e987fc48c` also reproduced **10 failures without the fix and 10 passes with it**, with no actionable code-review findings. That review's own UI stage produced no results; screenshot verification below comes from the separate public UI pipeline. ### Windows UI baseline updates The initial [UI build 1614797](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614797) exposed eight snapshots that encoded the old doubled spacing. Only those eight Windows baselines were updated from inspected CI captures. Item sizes, selection indicators, and closed swipe states are preserved; the changed gutters and resulting content positions reflect the corrected spacing. For example, `CVHorizontalLinearItemsLayoutItemSpacing` retains identical item widths while all five measured gaps change from 20 to the requested 10 pixels. [Device build 1614798](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614798), on the preceding code-identical head `5ee75080b0`, passed all ten new Windows regression cases. Its packaged and unpackaged Windows CollectionView result files each report **50 passed, 0 failed, 1 known skip**. After the snapshot updates, a fresh local device run also passed all ten targeted cases (full CollectionView results: 50 passed, 0 failed, 1 skipped). The current-head [device build 1614911](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614911) confirmed those same packaged and unpackaged Windows results, including all ten new regression cases. Local Appium screenshot verification was blocked by WinAppDriver's `/status` returning HTTP 500, so none of the eight UI methods ran locally. **All eight updated screenshot tests passed in [UI build 1614910](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614910)**, verified from their actual per-test results: `CVHorizontalLinearItemsLayoutItemSpacing`, `CollectionViewHeightIsCorrectAfterDelayedLoad`, `CollectionViewPreSelectionShouldUpdate`, `CollectionViewSelectionModeOnLightTheme`, `Issue23377ItemSpacing`, `OnlyManuallySwipedItemShouldBeOpened`, `VerifyCVBackgroundAndBackgroundColorWithVSM`, and `VerticalItemsRemainFullyVisibleAfterChangingSpacing`. These are CI screenshot passes, not an inference from the device tests. ### Build artifacts and CI scope [Main build 1614908](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614908) completed successfully. Its **PackageArtifacts** archive contains `Microsoft.Maui.Controls` and `Microsoft.Maui.Controls.Core` version **`10.0.120-ci.pr38960.26478.60`**, including the Windows framework assemblies. Follow [Testing PR Builds](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) to try these packages. The broader device and UI pipelines are **not all green**. Their non-Windows failures and timed-out retries are tracked separately from the verified Windows spacing results; the targeted passes above do not imply whole-suite success. ### Related work After developing this fix independently, I checked for existing fixes. #38367 addresses a different untemplated-grid stretching issue in the .NET 11 handler; it does not correct these additive margins/paddings in the current Windows handler. ### Issues Fixed Fixes #38959 --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change Windows CollectionView applied the full requested spacing to both sides of each item container. Adjacent margins/paddings add, so `ItemSpacing="30"` produced a **60-DIP gap**, not 30. Split the requested spacing evenly between the two contributing sides in `StructuredItemsViewHandler.Windows.cs`: - Vertical linear layouts: top/bottom margins. - Horizontal linear layouts: left/right padding. - Grid layouts: horizontal/vertical margins. For any finite spacing `S`, the adjacent contributions become `S/2 + S/2 = S`. This is not a DPI correction: WinUI handles scaling of these logical units. Default zero spacing, the existing symmetric edge-spacing approach, and native style inheritance are retained. Applications compensating for the doubled spacing will need to remove that workaround. This changes the default Windows CollectionView handler, not the opt-in obsolete compatibility renderer. ### Empirical before/after evidence The issue's XAML scenario was reproduced in the Sandbox against repository sources on Windows ARM64. These are actual WinUI-rendered page captures, not mockups. Native item bounds were measured after layout. | Before: requested 30, measured 60 DIPs | After: requested 30, measured 30 DIPs | |---|---| |  |  | Item dimensions stayed **300 × 40 DIPs**. Before, item Y positions were `30, 130, 230, 330, 430, 530, 630`; after, `15, 85, 155, 225, 295, 365, 435`. All six adjacent gaps changed from 60 to 30 DIPs. Additional runtime sampling completed **20 captures with zero geometry-check failures**, including both linear orientations, both grid orientations, and changing spacing back to zero: | Requested linear spacing | Measured vertical gap | Measured horizontal gap | |---:|---:|---:| | 0 | 0 | 0 | | 10 | 10 | 10 | | 30 | 30 | 30 | | 7.5 | 8 | 8 | | 0 after updates | 0 | 0 | All captures recorded `XamlRoot.RasterizationScale = 1.0` and layout rounding enabled. The fractional result is **8**, not exactly 7.5, due to pixel snapping. No other display scale was empirically tested, and no OS scaling settings were changed. Grid native-container gaps measured `30/10` for requested horizontal/vertical spacing `30/10`, in both orientations. Fixed-size content centered inside a larger grid cell can have additional whitespace; that is distinct from inter-container spacing. ### Regression coverage and verification Windows device tests cover rendered linear gaps at zero, fractional, and nonzero spacing; both grid axes/orientations; live spacing changes; and untemplated style mapping. The tests measure the current realized native view wrappers, reacquiring them when a style update replaces item templates. The repository's full A/B verification runner completed with **`VERIFICATION PASSED`**: - Original framework code: **10 failed, 0 passed** targeted cases. - Fixed framework code: **10 passed, 0 failed** targeted cases. The fix and tests were reviewed independently with GPT-5.3-Codex and GPT-5.6 Sol. Feedback was addressed, and final reviews reported no remaining actionable findings. The subsequent [independent Windows review](#38960 (review)) on head `2e987fc48c` also reproduced **10 failures without the fix and 10 passes with it**, with no actionable code-review findings. That review's own UI stage produced no results; screenshot verification below comes from the separate public UI pipeline. ### Windows UI baseline updates The initial [UI build 1614797](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614797) exposed eight snapshots that encoded the old doubled spacing. Only those eight Windows baselines were updated from inspected CI captures. Item sizes, selection indicators, and closed swipe states are preserved; the changed gutters and resulting content positions reflect the corrected spacing. For example, `CVHorizontalLinearItemsLayoutItemSpacing` retains identical item widths while all five measured gaps change from 20 to the requested 10 pixels. [Device build 1614798](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614798), on the preceding code-identical head `5ee75080b0`, passed all ten new Windows regression cases. Its packaged and unpackaged Windows CollectionView result files each report **50 passed, 0 failed, 1 known skip**. After the snapshot updates, a fresh local device run also passed all ten targeted cases (full CollectionView results: 50 passed, 0 failed, 1 skipped). The current-head [device build 1614911](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614911) confirmed those same packaged and unpackaged Windows results, including all ten new regression cases. Local Appium screenshot verification was blocked by WinAppDriver's `/status` returning HTTP 500, so none of the eight UI methods ran locally. **All eight updated screenshot tests passed in [UI build 1614910](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614910)**, verified from their actual per-test results: `CVHorizontalLinearItemsLayoutItemSpacing`, `CollectionViewHeightIsCorrectAfterDelayedLoad`, `CollectionViewPreSelectionShouldUpdate`, `CollectionViewSelectionModeOnLightTheme`, `Issue23377ItemSpacing`, `OnlyManuallySwipedItemShouldBeOpened`, `VerifyCVBackgroundAndBackgroundColorWithVSM`, and `VerticalItemsRemainFullyVisibleAfterChangingSpacing`. These are CI screenshot passes, not an inference from the device tests. ### Build artifacts and CI scope [Main build 1614908](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614908) completed successfully. Its **PackageArtifacts** archive contains `Microsoft.Maui.Controls` and `Microsoft.Maui.Controls.Core` version **`10.0.120-ci.pr38960.26478.60`**, including the Windows framework assemblies. Follow [Testing PR Builds](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) to try these packages. The broader device and UI pipelines are **not all green**. Their non-Windows failures and timed-out retries are tracked separately from the verified Windows spacing results; the targeted passes above do not imply whole-suite success. ### Related work After developing this fix independently, I checked for existing fixes. #38367 addresses a different untemplated-grid stretching issue in the .NET 11 handler; it does not correct these additive margins/paddings in the current Windows handler. ### Issues Fixed Fixes #38959 --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change Windows CollectionView applied the full requested spacing to both sides of each item container. Adjacent margins/paddings add, so `ItemSpacing="30"` produced a **60-DIP gap**, not 30. Split the requested spacing evenly between the two contributing sides in `StructuredItemsViewHandler.Windows.cs`: - Vertical linear layouts: top/bottom margins. - Horizontal linear layouts: left/right padding. - Grid layouts: horizontal/vertical margins. For any finite spacing `S`, the adjacent contributions become `S/2 + S/2 = S`. This is not a DPI correction: WinUI handles scaling of these logical units. Default zero spacing, the existing symmetric edge-spacing approach, and native style inheritance are retained. Applications compensating for the doubled spacing will need to remove that workaround. This changes the default Windows CollectionView handler, not the opt-in obsolete compatibility renderer. ### Empirical before/after evidence The issue's XAML scenario was reproduced in the Sandbox against repository sources on Windows ARM64. These are actual WinUI-rendered page captures, not mockups. Native item bounds were measured after layout. | Before: requested 30, measured 60 DIPs | After: requested 30, measured 30 DIPs | |---|---| |  |  | Item dimensions stayed **300 × 40 DIPs**. Before, item Y positions were `30, 130, 230, 330, 430, 530, 630`; after, `15, 85, 155, 225, 295, 365, 435`. All six adjacent gaps changed from 60 to 30 DIPs. Additional runtime sampling completed **20 captures with zero geometry-check failures**, including both linear orientations, both grid orientations, and changing spacing back to zero: | Requested linear spacing | Measured vertical gap | Measured horizontal gap | |---:|---:|---:| | 0 | 0 | 0 | | 10 | 10 | 10 | | 30 | 30 | 30 | | 7.5 | 8 | 8 | | 0 after updates | 0 | 0 | All captures recorded `XamlRoot.RasterizationScale = 1.0` and layout rounding enabled. The fractional result is **8**, not exactly 7.5, due to pixel snapping. No other display scale was empirically tested, and no OS scaling settings were changed. Grid native-container gaps measured `30/10` for requested horizontal/vertical spacing `30/10`, in both orientations. Fixed-size content centered inside a larger grid cell can have additional whitespace; that is distinct from inter-container spacing. ### Regression coverage and verification Windows device tests cover rendered linear gaps at zero, fractional, and nonzero spacing; both grid axes/orientations; live spacing changes; and untemplated style mapping. The tests measure the current realized native view wrappers, reacquiring them when a style update replaces item templates. The repository's full A/B verification runner completed with **`VERIFICATION PASSED`**: - Original framework code: **10 failed, 0 passed** targeted cases. - Fixed framework code: **10 passed, 0 failed** targeted cases. The fix and tests were reviewed independently with GPT-5.3-Codex and GPT-5.6 Sol. Feedback was addressed, and final reviews reported no remaining actionable findings. The subsequent [independent Windows review](#38960 (review)) on head `2e987fc48c` also reproduced **10 failures without the fix and 10 passes with it**, with no actionable code-review findings. That review's own UI stage produced no results; screenshot verification below comes from the separate public UI pipeline. ### Windows UI baseline updates The initial [UI build 1614797](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614797) exposed eight snapshots that encoded the old doubled spacing. Only those eight Windows baselines were updated from inspected CI captures. Item sizes, selection indicators, and closed swipe states are preserved; the changed gutters and resulting content positions reflect the corrected spacing. For example, `CVHorizontalLinearItemsLayoutItemSpacing` retains identical item widths while all five measured gaps change from 20 to the requested 10 pixels. [Device build 1614798](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614798), on the preceding code-identical head `5ee75080b0`, passed all ten new Windows regression cases. Its packaged and unpackaged Windows CollectionView result files each report **50 passed, 0 failed, 1 known skip**. After the snapshot updates, a fresh local device run also passed all ten targeted cases (full CollectionView results: 50 passed, 0 failed, 1 skipped). The current-head [device build 1614911](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614911) confirmed those same packaged and unpackaged Windows results, including all ten new regression cases. Local Appium screenshot verification was blocked by WinAppDriver's `/status` returning HTTP 500, so none of the eight UI methods ran locally. **All eight updated screenshot tests passed in [UI build 1614910](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614910)**, verified from their actual per-test results: `CVHorizontalLinearItemsLayoutItemSpacing`, `CollectionViewHeightIsCorrectAfterDelayedLoad`, `CollectionViewPreSelectionShouldUpdate`, `CollectionViewSelectionModeOnLightTheme`, `Issue23377ItemSpacing`, `OnlyManuallySwipedItemShouldBeOpened`, `VerifyCVBackgroundAndBackgroundColorWithVSM`, and `VerticalItemsRemainFullyVisibleAfterChangingSpacing`. These are CI screenshot passes, not an inference from the device tests. ### Build artifacts and CI scope [Main build 1614908](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614908) completed successfully. Its **PackageArtifacts** archive contains `Microsoft.Maui.Controls` and `Microsoft.Maui.Controls.Core` version **`10.0.120-ci.pr38960.26478.60`**, including the Windows framework assemblies. Follow [Testing PR Builds](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) to try these packages. The broader device and UI pipelines are **not all green**. Their non-Windows failures and timed-out retries are tracked separately from the verified Windows spacing results; the targeted passes above do not imply whole-suite success. ### Related work After developing this fix independently, I checked for existing fixes. #38367 addresses a different untemplated-grid stretching issue in the .NET 11 handler; it does not correct these additive margins/paddings in the current Windows handler. ### Issues Fixed Fixes #38959 --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change Windows CollectionView applied the full requested spacing to both sides of each item container. Adjacent margins/paddings add, so `ItemSpacing="30"` produced a **60-DIP gap**, not 30. Split the requested spacing evenly between the two contributing sides in `StructuredItemsViewHandler.Windows.cs`: - Vertical linear layouts: top/bottom margins. - Horizontal linear layouts: left/right padding. - Grid layouts: horizontal/vertical margins. For any finite spacing `S`, the adjacent contributions become `S/2 + S/2 = S`. This is not a DPI correction: WinUI handles scaling of these logical units. Default zero spacing, the existing symmetric edge-spacing approach, and native style inheritance are retained. Applications compensating for the doubled spacing will need to remove that workaround. This changes the default Windows CollectionView handler, not the opt-in obsolete compatibility renderer. ### Empirical before/after evidence The issue's XAML scenario was reproduced in the Sandbox against repository sources on Windows ARM64. These are actual WinUI-rendered page captures, not mockups. Native item bounds were measured after layout. | Before: requested 30, measured 60 DIPs | After: requested 30, measured 30 DIPs | |---|---| |  |  | Item dimensions stayed **300 × 40 DIPs**. Before, item Y positions were `30, 130, 230, 330, 430, 530, 630`; after, `15, 85, 155, 225, 295, 365, 435`. All six adjacent gaps changed from 60 to 30 DIPs. Additional runtime sampling completed **20 captures with zero geometry-check failures**, including both linear orientations, both grid orientations, and changing spacing back to zero: | Requested linear spacing | Measured vertical gap | Measured horizontal gap | |---:|---:|---:| | 0 | 0 | 0 | | 10 | 10 | 10 | | 30 | 30 | 30 | | 7.5 | 8 | 8 | | 0 after updates | 0 | 0 | All captures recorded `XamlRoot.RasterizationScale = 1.0` and layout rounding enabled. The fractional result is **8**, not exactly 7.5, due to pixel snapping. No other display scale was empirically tested, and no OS scaling settings were changed. Grid native-container gaps measured `30/10` for requested horizontal/vertical spacing `30/10`, in both orientations. Fixed-size content centered inside a larger grid cell can have additional whitespace; that is distinct from inter-container spacing. ### Regression coverage and verification Windows device tests cover rendered linear gaps at zero, fractional, and nonzero spacing; both grid axes/orientations; live spacing changes; and untemplated style mapping. The tests measure the current realized native view wrappers, reacquiring them when a style update replaces item templates. The repository's full A/B verification runner completed with **`VERIFICATION PASSED`**: - Original framework code: **10 failed, 0 passed** targeted cases. - Fixed framework code: **10 passed, 0 failed** targeted cases. The fix and tests were reviewed independently with GPT-5.3-Codex and GPT-5.6 Sol. Feedback was addressed, and final reviews reported no remaining actionable findings. The subsequent [independent Windows review](#38960 (review)) on head `2e987fc48c` also reproduced **10 failures without the fix and 10 passes with it**, with no actionable code-review findings. That review's own UI stage produced no results; screenshot verification below comes from the separate public UI pipeline. ### Windows UI baseline updates The initial [UI build 1614797](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614797) exposed eight snapshots that encoded the old doubled spacing. Only those eight Windows baselines were updated from inspected CI captures. Item sizes, selection indicators, and closed swipe states are preserved; the changed gutters and resulting content positions reflect the corrected spacing. For example, `CVHorizontalLinearItemsLayoutItemSpacing` retains identical item widths while all five measured gaps change from 20 to the requested 10 pixels. [Device build 1614798](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614798), on the preceding code-identical head `5ee75080b0`, passed all ten new Windows regression cases. Its packaged and unpackaged Windows CollectionView result files each report **50 passed, 0 failed, 1 known skip**. After the snapshot updates, a fresh local device run also passed all ten targeted cases (full CollectionView results: 50 passed, 0 failed, 1 skipped). The current-head [device build 1614911](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614911) confirmed those same packaged and unpackaged Windows results, including all ten new regression cases. Local Appium screenshot verification was blocked by WinAppDriver's `/status` returning HTTP 500, so none of the eight UI methods ran locally. **All eight updated screenshot tests passed in [UI build 1614910](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614910)**, verified from their actual per-test results: `CVHorizontalLinearItemsLayoutItemSpacing`, `CollectionViewHeightIsCorrectAfterDelayedLoad`, `CollectionViewPreSelectionShouldUpdate`, `CollectionViewSelectionModeOnLightTheme`, `Issue23377ItemSpacing`, `OnlyManuallySwipedItemShouldBeOpened`, `VerifyCVBackgroundAndBackgroundColorWithVSM`, and `VerticalItemsRemainFullyVisibleAfterChangingSpacing`. These are CI screenshot passes, not an inference from the device tests. ### Build artifacts and CI scope [Main build 1614908](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614908) completed successfully. Its **PackageArtifacts** archive contains `Microsoft.Maui.Controls` and `Microsoft.Maui.Controls.Core` version **`10.0.120-ci.pr38960.26478.60`**, including the Windows framework assemblies. Follow [Testing PR Builds](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) to try these packages. The broader device and UI pipelines are **not all green**. Their non-Windows failures and timed-out retries are tracked separately from the verified Windows spacing results; the targeted passes above do not imply whole-suite success. ### Related work After developing this fix independently, I checked for existing fixes. #38367 addresses a different untemplated-grid stretching issue in the .NET 11 handler; it does not correct these additive margins/paddings in the current Windows handler. ### Issues Fixed Fixes #38959 --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change Windows CollectionView applied the full requested spacing to both sides of each item container. Adjacent margins/paddings add, so `ItemSpacing="30"` produced a **60-DIP gap**, not 30. Split the requested spacing evenly between the two contributing sides in `StructuredItemsViewHandler.Windows.cs`: - Vertical linear layouts: top/bottom margins. - Horizontal linear layouts: left/right padding. - Grid layouts: horizontal/vertical margins. For any finite spacing `S`, the adjacent contributions become `S/2 + S/2 = S`. This is not a DPI correction: WinUI handles scaling of these logical units. Default zero spacing, the existing symmetric edge-spacing approach, and native style inheritance are retained. Applications compensating for the doubled spacing will need to remove that workaround. This changes the default Windows CollectionView handler, not the opt-in obsolete compatibility renderer. ### Empirical before/after evidence The issue's XAML scenario was reproduced in the Sandbox against repository sources on Windows ARM64. These are actual WinUI-rendered page captures, not mockups. Native item bounds were measured after layout. | Before: requested 30, measured 60 DIPs | After: requested 30, measured 30 DIPs | |---|---| |  |  | Item dimensions stayed **300 × 40 DIPs**. Before, item Y positions were `30, 130, 230, 330, 430, 530, 630`; after, `15, 85, 155, 225, 295, 365, 435`. All six adjacent gaps changed from 60 to 30 DIPs. Additional runtime sampling completed **20 captures with zero geometry-check failures**, including both linear orientations, both grid orientations, and changing spacing back to zero: | Requested linear spacing | Measured vertical gap | Measured horizontal gap | |---:|---:|---:| | 0 | 0 | 0 | | 10 | 10 | 10 | | 30 | 30 | 30 | | 7.5 | 8 | 8 | | 0 after updates | 0 | 0 | All captures recorded `XamlRoot.RasterizationScale = 1.0` and layout rounding enabled. The fractional result is **8**, not exactly 7.5, due to pixel snapping. No other display scale was empirically tested, and no OS scaling settings were changed. Grid native-container gaps measured `30/10` for requested horizontal/vertical spacing `30/10`, in both orientations. Fixed-size content centered inside a larger grid cell can have additional whitespace; that is distinct from inter-container spacing. ### Regression coverage and verification Windows device tests cover rendered linear gaps at zero, fractional, and nonzero spacing; both grid axes/orientations; live spacing changes; and untemplated style mapping. The tests measure the current realized native view wrappers, reacquiring them when a style update replaces item templates. The repository's full A/B verification runner completed with **`VERIFICATION PASSED`**: - Original framework code: **10 failed, 0 passed** targeted cases. - Fixed framework code: **10 passed, 0 failed** targeted cases. The fix and tests were reviewed independently with GPT-5.3-Codex and GPT-5.6 Sol. Feedback was addressed, and final reviews reported no remaining actionable findings. The subsequent [independent Windows review](#38960 (review)) on head `2e987fc48c` also reproduced **10 failures without the fix and 10 passes with it**, with no actionable code-review findings. That review's own UI stage produced no results; screenshot verification below comes from the separate public UI pipeline. ### Windows UI baseline updates The initial [UI build 1614797](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614797) exposed eight snapshots that encoded the old doubled spacing. Only those eight Windows baselines were updated from inspected CI captures. Item sizes, selection indicators, and closed swipe states are preserved; the changed gutters and resulting content positions reflect the corrected spacing. For example, `CVHorizontalLinearItemsLayoutItemSpacing` retains identical item widths while all five measured gaps change from 20 to the requested 10 pixels. [Device build 1614798](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614798), on the preceding code-identical head `5ee75080b0`, passed all ten new Windows regression cases. Its packaged and unpackaged Windows CollectionView result files each report **50 passed, 0 failed, 1 known skip**. After the snapshot updates, a fresh local device run also passed all ten targeted cases (full CollectionView results: 50 passed, 0 failed, 1 skipped). The current-head [device build 1614911](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614911) confirmed those same packaged and unpackaged Windows results, including all ten new regression cases. Local Appium screenshot verification was blocked by WinAppDriver's `/status` returning HTTP 500, so none of the eight UI methods ran locally. **All eight updated screenshot tests passed in [UI build 1614910](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614910)**, verified from their actual per-test results: `CVHorizontalLinearItemsLayoutItemSpacing`, `CollectionViewHeightIsCorrectAfterDelayedLoad`, `CollectionViewPreSelectionShouldUpdate`, `CollectionViewSelectionModeOnLightTheme`, `Issue23377ItemSpacing`, `OnlyManuallySwipedItemShouldBeOpened`, `VerifyCVBackgroundAndBackgroundColorWithVSM`, and `VerticalItemsRemainFullyVisibleAfterChangingSpacing`. These are CI screenshot passes, not an inference from the device tests. ### Build artifacts and CI scope [Main build 1614908](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1614908) completed successfully. Its **PackageArtifacts** archive contains `Microsoft.Maui.Controls` and `Microsoft.Maui.Controls.Core` version **`10.0.120-ci.pr38960.26478.60`**, including the Windows framework assemblies. Follow [Testing PR Builds](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) to try these packages. The broader device and UI pipelines are **not all green**. Their non-Windows failures and timed-out retries are tracked separately from the verified Windows spacing results; the targeted passes above do not imply whole-suite success. ### Related work After developing this fix independently, I checked for existing fixes. #38367 addresses a different untemplated-grid stretching issue in the .NET 11 handler; it does not correct these additive margins/paddings in the current Windows handler. ### Issues Fixed Fixes #38959 --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description of Change
Windows CollectionView applied the full requested spacing to both sides of each item container. Adjacent margins/paddings add, so
ItemSpacing="30"produced a 60-DIP gap, not 30.Split the requested spacing evenly between the two contributing sides in
StructuredItemsViewHandler.Windows.cs:For any finite spacing
S, the adjacent contributions becomeS/2 + S/2 = S. This is not a DPI correction: WinUI handles scaling of these logical units. Default zero spacing, the existing symmetric edge-spacing approach, and native style inheritance are retained. Applications compensating for the doubled spacing will need to remove that workaround. This changes the default Windows CollectionView handler, not the opt-in obsolete compatibility renderer.Empirical before/after evidence
The issue's XAML scenario was reproduced in the Sandbox against repository sources on Windows ARM64. These are actual WinUI-rendered page captures, not mockups. Native item bounds were measured after layout.
Item dimensions stayed 300 × 40 DIPs. Before, item Y positions were
30, 130, 230, 330, 430, 530, 630; after,15, 85, 155, 225, 295, 365, 435. All six adjacent gaps changed from 60 to 30 DIPs.Additional runtime sampling completed 20 captures with zero geometry-check failures, including both linear orientations, both grid orientations, and changing spacing back to zero:
All captures recorded
XamlRoot.RasterizationScale = 1.0and layout rounding enabled. The fractional result is 8, not exactly 7.5, due to pixel snapping. No other display scale was empirically tested, and no OS scaling settings were changed.Grid native-container gaps measured
30/10for requested horizontal/vertical spacing30/10, in both orientations. Fixed-size content centered inside a larger grid cell can have additional whitespace; that is distinct from inter-container spacing.Regression coverage and verification
Windows device tests cover rendered linear gaps at zero, fractional, and nonzero spacing; both grid axes/orientations; live spacing changes; and untemplated style mapping. The tests measure the current realized native view wrappers, reacquiring them when a style update replaces item templates.
The repository's full A/B verification runner completed with
VERIFICATION PASSED:The fix and tests were reviewed independently with GPT-5.3-Codex and GPT-5.6 Sol. Feedback was addressed, and final reviews reported no remaining actionable findings. The subsequent independent Windows review on head
2e987fc48calso reproduced 10 failures without the fix and 10 passes with it, with no actionable code-review findings. That review's own UI stage produced no results; screenshot verification below comes from the separate public UI pipeline.Windows UI baseline updates
The initial UI build 1614797 exposed eight snapshots that encoded the old doubled spacing. Only those eight Windows baselines were updated from inspected CI captures. Item sizes, selection indicators, and closed swipe states are preserved; the changed gutters and resulting content positions reflect the corrected spacing. For example,
CVHorizontalLinearItemsLayoutItemSpacingretains identical item widths while all five measured gaps change from 20 to the requested 10 pixels.Device build 1614798, on the preceding code-identical head
5ee75080b0, passed all ten new Windows regression cases. Its packaged and unpackaged Windows CollectionView result files each report 50 passed, 0 failed, 1 known skip. After the snapshot updates, a fresh local device run also passed all ten targeted cases (full CollectionView results: 50 passed, 0 failed, 1 skipped). The current-head device build 1614911 confirmed those same packaged and unpackaged Windows results, including all ten new regression cases.Local Appium screenshot verification was blocked by WinAppDriver's
/statusreturning HTTP 500, so none of the eight UI methods ran locally. All eight updated screenshot tests passed in UI build 1614910, verified from their actual per-test results:CVHorizontalLinearItemsLayoutItemSpacing,CollectionViewHeightIsCorrectAfterDelayedLoad,CollectionViewPreSelectionShouldUpdate,CollectionViewSelectionModeOnLightTheme,Issue23377ItemSpacing,OnlyManuallySwipedItemShouldBeOpened,VerifyCVBackgroundAndBackgroundColorWithVSM, andVerticalItemsRemainFullyVisibleAfterChangingSpacing. These are CI screenshot passes, not an inference from the device tests.Build artifacts and CI scope
Main build 1614908 completed successfully. Its PackageArtifacts archive contains
Microsoft.Maui.ControlsandMicrosoft.Maui.Controls.Coreversion10.0.120-ci.pr38960.26478.60, including the Windows framework assemblies. Follow Testing PR Builds to try these packages.The broader device and UI pipelines are not all green. Their non-Windows failures and timed-out retries are tracked separately from the verified Windows spacing results; the targeted passes above do not imply whole-suite success.
Related work
After developing this fix independently, I checked for existing fixes. #38367 addresses a different untemplated-grid stretching issue in the .NET 11 handler; it does not correct these additive margins/paddings in the current Windows handler.
Issues Fixed
Fixes #38959