Skip to content

[iOS/Mac] Fix CollectionView height shrinking without regressing nested scrolling - #39882

Merged
kubaflo merged 4 commits into
dotnet:candidate/11.0.1xx-sr2from
sheiksyedm:fix-38276-collectionview-height
Nov 11, 2026
Merged

kubaflo merged 4 commits into
dotnet:candidate/11.0.1xx-sr2from
sheiksyedm:fix-38276-collectionview-height

Conversation

@sheiksyedm

Copy link
Copy Markdown
Contributor

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

Fix CollectionView height updates after replacing ItemsSource with fewer items on iOS and Mac Catalyst, while preserving sizing behavior when CollectionView is nested inside ScrollView.

In #38276, CollectionView retains its previously rendered height after the item count decreases, leaving unused space and stale Height/SizeChanged values. The previous fix, #38441, moved content-size checking exclusively to ViewDidLayoutSubviews. This introduced the nested-scroll regression reported in #39847: the CollectionView could remain smaller than its content, creating an additional vertical scroll range inside the outer ScrollView. That fix was reverted by #39856.

This replacement builds on the reverted implementation:

  • Preserve the existing ViewWillLayoutSubviews content-size check.
  • Add a guarded ViewDidLayoutSubviews check to detect self-sizing content changes resolved during native layout, allowing the CollectionView to shrink.
  • Skip the post-layout check when content exceeds the current bounds in the scrolling direction, without updating the cached content size. This leaves growth detection to the pre-layout check and avoids the nested-scroll regression.
  • Refresh empty-source tracking when replacing ItemsSource so grouped collections collapsed to zero can grow again, even when UIKit defers data-source callbacks.
  • Restore the required iOS and Mac Catalyst public API entries for the layout callback override.

Issues Fixed

Fixes #38276

Related: #39847 — adds coverage to prevent reintroducing the nested-scroll regression already addressed by the revert.

Preserve pre-layout content-size invalidation and check resolved sizes after layout only when content fits the scroll-direction bounds. Refresh empty-source tracking so collapsed grouped collections can grow again.

Add device coverage for nested scrolling, constrained Grid sizing, grouped empty transitions, and horizontal and vertical measurement invalidation.
Copilot AI balanced review requested due to automatic review settings November 4, 2026 10:48
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 39882

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 39882"

@azure-pipelines

This comment has been minimized.

@sheiksyedm
sheiksyedm marked this pull request as draft November 4, 2026 10:48
@dotnet-policy-service dotnet-policy-service Bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Nov 4, 2026
@github-actions github-actions Bot added area-controls-collectionview CollectionView, CarouselView, IndicatorView platform/ios platform/macos macOS / Mac Catalyst labels Nov 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Native tests could not be run, leaving the previously reverted UIKit layout-timing fix unverified on iOS and Mac Catalyst for nested scrolling, self-sizing, and CarouselView behavior.

No open issues 🎉

What changed in this PR

This PR updates the iOS and Mac Catalyst CollectionView handler to shrink after ItemsSource is replaced with fewer items, while preserving content expansion inside a ScrollView.

Changes:

  • Adds a guarded post-layout content-size check while retaining pre-layout growth detection.
  • Refreshes empty-source tracking so collapsed collections can grow again.
  • Adds regression tests for shrinking, nested scrolling, grouped collections, and layout callbacks, plus the corresponding public API entries.
File Description
src/​Controls/​tests/​DeviceTests/​Elements/​CollectionView/​CollectionViewNestedScrollingTests.iOS.cs Adds resizing and nested-scrolling regression coverage.
src/​Controls/​src/​Core/​PublicAPI/​net-maccatalyst/​PublicAPI.Unshipped.txt Records the Mac Catalyst layout callback override.
src/​Controls/​src/​Core/​PublicAPI/​net-ios/​PublicAPI.Unshipped.txt Records the iOS layout callback override.
src/​Controls/​src/​Core/​Handlers/​Items2/​iOS/​ItemsViewController2.cs Adds guarded post-layout measurement invalidation and refreshes empty-source state.

Review effort: Balanced

@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Nov 4, 2026
@kubaflo

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expert Review — 0 findings

Reviewed commit ea77867.

@MauiBot

MauiBot commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

PR Test Gate

@sheiksyedm — existing-test verification; Setup did not capture a tested commit.

Result INCONCLUSIVE Platform iOS


🧪 Gate analysis — click to expand

⚠ Inconclusive. Setup, build, or execution did not produce a conclusive result. This does not prove the fix is incorrect.

No interpretable test-group summary was produced. No additional test execution is inferred.

Setup did not capture a verified PR head; no commit is claimed as tested.

No immutable without-fix baseline was prepared.

Schedule a native layout pass when overflowing content changes after layout, preserving pre-layout measurement and nested-scroll behavior. Account for floating-point rounding when comparing fitted content with viewport bounds.

Cover repeated button-driven grow/shrink cycles and fractional bounds in device tests.
@kubaflo

This comment has been minimized.

@kubaflo
kubaflo changed the base branch from main to candidate/11.0.1xx-sr2 November 11, 2026 12:02
@kubaflo
kubaflo merged commit e4076ec into dotnet:candidate/11.0.1xx-sr2 Nov 11, 2026
155 of 177 checks passed
kubaflo pushed a commit that referenced this pull request Nov 11, 2026
…ed scrolling (#39882)

<!-- 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!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Description of Change

<!-- Enter description of the fix in this section -->

Fix CollectionView height updates after replacing ItemsSource with fewer
items on iOS and Mac Catalyst, while preserving sizing behavior when
CollectionView is nested inside ScrollView.

In #38276, CollectionView retains its previously rendered
height after the item count decreases, leaving unused space and stale
Height/SizeChanged values. The previous fix, #38441, moved
content-size checking exclusively to ViewDidLayoutSubviews. This
introduced the nested-scroll regression reported in #39847:
the CollectionView could remain smaller than its content, creating an
additional vertical scroll range inside the outer ScrollView. That fix
was reverted by #39856.

This replacement builds on the reverted implementation:

- Preserve the existing ViewWillLayoutSubviews content-size check.
- Add a guarded ViewDidLayoutSubviews check to detect self-sizing
content changes resolved during native layout, allowing the
CollectionView to shrink.
- Skip the post-layout check when content exceeds the current bounds in
the scrolling direction, without updating the cached content size. This
leaves growth detection to the pre-layout check and avoids the
nested-scroll regression.
- Refresh empty-source tracking when replacing ItemsSource so grouped
collections collapsed to zero can grow again, even when UIKit defers
data-source callbacks.
- Restore the required iOS and Mac Catalyst public API entries for the
layout callback override.


### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #38276

Related: #39847 — adds coverage to prevent reintroducing the
nested-scroll regression already addressed by the revert.

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
kubaflo added a commit that referenced this pull request Nov 13, 2026
…on backports (#40217)

<!-- 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!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Description of Change

**Explicit release-target exception:** this PR intentionally targets the
new `release/10.0.1xx-sr14` branch. `main`, `net11` and the inflight
lanes are now .NET 11, so .NET 10 SR14 is cut from the SR13 release head
(`release/10.0.1xx-sr14` was created at `54d76458e0`, the tip of
`release/10.0.1xx-sr13`, which already includes all post-cut SR13 fixes
#39830, #39855, #39879, #39891 and the servicing/stable configuration
from #39774).

This PR brings the .NET 10 changes needed since SR13:

1. **Backport #39887** – `[Windows] Prevent duplicate Shell startup
navigation from stale tab selection events`. Fixes #39859 (regressed in
10.0.120); it was merged only to `main`. Clean `cherry-pick -x`.
2. **Backport #40132** – `Fix custom Shape.PathForBounds dispatch
regression`. Fixes #40129 (regressed in 10.0.130); it was merged only to
`candidate/11.0.1xx-sr2`. The unrelated .NET 11
`eng/release-rollover.json` change from that commit is excluded (file
does not exist on the .NET 10 line).
3. **Version bump** – `PatchVersion` 130 → 140 in `eng/Versions.props`.
Servicing label and `StabilizePackageVersion=true` are inherited from
SR13.

Reviewed and intentionally **not** included:

- #40136 (`net10.0` Publish-Build-Assets cleanup): SR13 has no
`Publish-Build-Assets` references, so nothing to remove.
- #39882 (re-land of the CollectionView2 height fix): SR13 already
carries the revert #39855 that fixed #39847; re-landing is a
fix-forward, not a regression fix.
- #40213 (`[net10.0][XSG]` CA2252 suppression, issue #40045): still
open/unmerged; can be backported once approved.
- Other `regressed-in-10.0.1x0` issues closed since the SR13 cut
(#38622, #39557/#39681, #39722) are already fixed on SR13 or were fixed
outside MAUI.

Keep in draft pending review and CI. This PR does not tag, publish, or
authorize a release; the internal dnceng mirror of
`release/10.0.1xx-sr14` has not been created.

#### Validation

Using the pinned SDK `10.0.113` provisioned by `eng/common/dotnet.sh`:

- `dotnet msbuild eng/Versions.props
-getProperty:PatchVersion,SdkBandVersion,PreReleaseVersionLabel,StabilizePackageVersion,DotNetFinalVersionKind`
→ `140`, `10.0.100`, `servicing`, `true`, `release`. `xmllint --noout
eng/Versions.props` passed.
- `dotnet test
src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj -f
net10.0 --filter FullyQualifiedName~StrokeShapeTests` (platform TFMs
disabled): **passed 59/59**. With `Shape.cs` reverted to SR13: **failed
3/59** (the new `CustomShapeReimplementingIShape*` tests); restored:
**passed 59/59**.
- #39887 is Windows-only (`ShellItemHandler.Windows.cs` + Windows device
test) and was not built locally on macOS; it relies on CI.

### Issues Fixed

Fixes #39859
Fixes #40129

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

---------
kubaflo added a commit that referenced this pull request Nov 13, 2026
…#40226)

<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, based on `41458556cf5d13573a632b83f89072f8badfb205`. No
retargeting or merging is requested.

### Description of Change

<!-- Enter description of the fix in this section -->

Fix the repeated iOS `Issue16320Test` regression without changing its
sample, assertions, timeouts, snapshots, or layout requests.

#39778 correctly prevents an unbounded cross-axis native probe from
returning the temporary 10,000-point frame as content height. However,
the horizontal fallback still resets height to zero. A horizontal
CollectionView in an Auto row, without an explicit
height/minimum/maximum, therefore never receives usable native bounds
and cannot realize its items. The unchanged UI test finds and taps
`Add`, then times out waiting for `item: 1`.

For horizontal **linear** CollectionViews that reach this unbounded
fallback, measure the first actual item's intrinsic height instead of
returning zero. Reuse normal templated-cell binding, including template
selection and binding context; skip empty leading groups; support the
native default cell when there is no template. Unbind and disconnect the
temporary template tree after measurement.

The native-probe guard and explicit/minimum/maximum constraint
resolution remain unchanged. Finite probes, vertical layouts,
CarouselView, grids, controller/scroll-update logic, and the original UI
test/sample are unchanged.

#### Native causal evidence

All local native runs used an isolated **iPhone 11 Pro CoreSimulator,
iOS 26.5**. Production source was rebuilt with the available **.NET SDK
11.0.100 / iOS SDK 27.2 / Xcode 27.2**. These are diagnostic source
builds, **not** a replay of the exact CI binary or validation of the
unavailable pinned Xcode 27.0 toolchain. No SDK-version check was
disabled.

| State | Actual native result |
| --- | --- |
| Original candidate | Unchanged `Issue16320Test` fails at line 22 after
tapping Add. |
| Causal control: remove only the unbounded-probe guard | Original UI
test passes 1/1; this control is not included in the fix. |
| Intended correction | Original UI test passes 3/3; focused device
sizing suite passes 18/18. |
| Restore the exact original production file, retain new tests | All 3
new cases fail at height 0; all 15 existing constraint/probe cases pass.
|
| Restore the correction | Focused device sizing suite passes 18/18
again. |

The three new device cases cover bound templates, grouping with an empty
leading group, and default/native content. Heights are compared with
actual label measurements, without fixed-height requests; each case
repeats measurement and verifies native-frame restoration. Existing
#39778 tests remain unchanged and passing.

Executed the unchanged UI oracle with:

```sh
dotnet test src/Controls/tests/TestCases.iOS.Tests/Controls.TestCases.iOS.Tests.csproj -f net11.0 -c Debug --no-build --no-restore --filter 'FullyQualifiedName~Issue16320Test'
```

Passed 3/3 against the correction, with `DEVICE_UDID` targeting the
isolated simulator and `HEADLESS=true`. Native XHarness ran these exact
discovered method selectors:

```text
[CollectionView] [NavigationRenderer] HorizontalCollectionViewPreMountHeightMeasuresContent
[CollectionView] [NavigationRenderer] HorizontalCollectionViewPreMountHeightRespectsConstraints
[CollectionView] [NavigationRenderer] VerticalCollectionViewPreMountWidthRespectsConstraints
[CollectionView] [NavigationRenderer] VerticalCollectionViewPreMountHeightMeasuresContent
```

The device diagnostic runner used a session-only standard scene manifest
and registered subclass of the existing test scene delegate; scene
validation stayed enabled. Its pre-existing obsolete legacy-handler
warning was nonfatal (`WarningsNotAsErrors=CS0618`). None of these
diagnostic provisioning files/settings are committed.

Formatting passed with:

```sh
dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Controls/src/Core/Handlers/Items2/ItemsViewHandler2.iOS.cs src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.iOS.cs --verbosity quiet
```

Exact pinned-toolchain CI and Mac Catalyst runtime validation are still
pending. Open and recently merged sizing PRs were checked: this corrects
#39778 rather than duplicating it or reverting its protection; #39882's
controller/shrinking logic and open #39935's header-resizing work are
not changed.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Relates to #40116 and #16320. Corrects the candidate regression
introduced by #39778 while preserving its fix for #39770.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo pushed a commit that referenced this pull request Nov 13, 2026
…ed scrolling (#39882)

<!-- 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!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Description of Change

<!-- Enter description of the fix in this section -->

Fix CollectionView height updates after replacing ItemsSource with fewer
items on iOS and Mac Catalyst, while preserving sizing behavior when
CollectionView is nested inside ScrollView.

In #38276, CollectionView retains its previously rendered
height after the item count decreases, leaving unused space and stale
Height/SizeChanged values. The previous fix, #38441, moved
content-size checking exclusively to ViewDidLayoutSubviews. This
introduced the nested-scroll regression reported in #39847:
the CollectionView could remain smaller than its content, creating an
additional vertical scroll range inside the outer ScrollView. That fix
was reverted by #39856.

This replacement builds on the reverted implementation:

- Preserve the existing ViewWillLayoutSubviews content-size check.
- Add a guarded ViewDidLayoutSubviews check to detect self-sizing
content changes resolved during native layout, allowing the
CollectionView to shrink.
- Skip the post-layout check when content exceeds the current bounds in
the scrolling direction, without updating the cached content size. This
leaves growth detection to the pre-layout check and avoids the
nested-scroll regression.
- Refresh empty-source tracking when replacing ItemsSource so grouped
collections collapsed to zero can grow again, even when UIKit defers
data-source callbacks.
- Restore the required iOS and Mac Catalyst public API entries for the
layout callback override.


### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #38276

Related: #39847 — adds coverage to prevent reintroducing the
nested-scroll regression already addressed by the revert.

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
kubaflo added a commit that referenced this pull request Nov 13, 2026
…#40226)

<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, based on `41458556cf5d13573a632b83f89072f8badfb205`. No
retargeting or merging is requested.

### Description of Change

<!-- Enter description of the fix in this section -->

Fix the repeated iOS `Issue16320Test` regression without changing its
sample, assertions, timeouts, snapshots, or layout requests.

#39778 correctly prevents an unbounded cross-axis native probe from
returning the temporary 10,000-point frame as content height. However,
the horizontal fallback still resets height to zero. A horizontal
CollectionView in an Auto row, without an explicit
height/minimum/maximum, therefore never receives usable native bounds
and cannot realize its items. The unchanged UI test finds and taps
`Add`, then times out waiting for `item: 1`.

For horizontal **linear** CollectionViews that reach this unbounded
fallback, measure the first actual item's intrinsic height instead of
returning zero. Reuse normal templated-cell binding, including template
selection and binding context; skip empty leading groups; support the
native default cell when there is no template. Unbind and disconnect the
temporary template tree after measurement.

The native-probe guard and explicit/minimum/maximum constraint
resolution remain unchanged. Finite probes, vertical layouts,
CarouselView, grids, controller/scroll-update logic, and the original UI
test/sample are unchanged.

#### Native causal evidence

All local native runs used an isolated **iPhone 11 Pro CoreSimulator,
iOS 26.5**. Production source was rebuilt with the available **.NET SDK
11.0.100 / iOS SDK 27.2 / Xcode 27.2**. These are diagnostic source
builds, **not** a replay of the exact CI binary or validation of the
unavailable pinned Xcode 27.0 toolchain. No SDK-version check was
disabled.

| State | Actual native result |
| --- | --- |
| Original candidate | Unchanged `Issue16320Test` fails at line 22 after
tapping Add. |
| Causal control: remove only the unbounded-probe guard | Original UI
test passes 1/1; this control is not included in the fix. |
| Intended correction | Original UI test passes 3/3; focused device
sizing suite passes 18/18. |
| Restore the exact original production file, retain new tests | All 3
new cases fail at height 0; all 15 existing constraint/probe cases pass.
|
| Restore the correction | Focused device sizing suite passes 18/18
again. |

The three new device cases cover bound templates, grouping with an empty
leading group, and default/native content. Heights are compared with
actual label measurements, without fixed-height requests; each case
repeats measurement and verifies native-frame restoration. Existing
#39778 tests remain unchanged and passing.

Executed the unchanged UI oracle with:

```sh
dotnet test src/Controls/tests/TestCases.iOS.Tests/Controls.TestCases.iOS.Tests.csproj -f net11.0 -c Debug --no-build --no-restore --filter 'FullyQualifiedName~Issue16320Test'
```

Passed 3/3 against the correction, with `DEVICE_UDID` targeting the
isolated simulator and `HEADLESS=true`. Native XHarness ran these exact
discovered method selectors:

```text
[CollectionView] [NavigationRenderer] HorizontalCollectionViewPreMountHeightMeasuresContent
[CollectionView] [NavigationRenderer] HorizontalCollectionViewPreMountHeightRespectsConstraints
[CollectionView] [NavigationRenderer] VerticalCollectionViewPreMountWidthRespectsConstraints
[CollectionView] [NavigationRenderer] VerticalCollectionViewPreMountHeightMeasuresContent
```

The device diagnostic runner used a session-only standard scene manifest
and registered subclass of the existing test scene delegate; scene
validation stayed enabled. Its pre-existing obsolete legacy-handler
warning was nonfatal (`WarningsNotAsErrors=CS0618`). None of these
diagnostic provisioning files/settings are committed.

Formatting passed with:

```sh
dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Controls/src/Core/Handlers/Items2/ItemsViewHandler2.iOS.cs src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.iOS.cs --verbosity quiet
```

Exact pinned-toolchain CI and Mac Catalyst runtime validation are still
pending. Open and recently merged sizing PRs were checked: this corrects
#39778 rather than duplicating it or reverting its protection; #39882's
controller/shrinking logic and open #39935's header-resizing work are
not changed.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Relates to #40116 and #16320. Corrects the candidate regression
introduced by #39778 while preserving its fix for #39770.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo pushed a commit that referenced this pull request Nov 16, 2026
…ed scrolling (#39882)

<!-- 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!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Description of Change

<!-- Enter description of the fix in this section -->

Fix CollectionView height updates after replacing ItemsSource with fewer
items on iOS and Mac Catalyst, while preserving sizing behavior when
CollectionView is nested inside ScrollView.

In #38276, CollectionView retains its previously rendered
height after the item count decreases, leaving unused space and stale
Height/SizeChanged values. The previous fix, #38441, moved
content-size checking exclusively to ViewDidLayoutSubviews. This
introduced the nested-scroll regression reported in #39847:
the CollectionView could remain smaller than its content, creating an
additional vertical scroll range inside the outer ScrollView. That fix
was reverted by #39856.

This replacement builds on the reverted implementation:

- Preserve the existing ViewWillLayoutSubviews content-size check.
- Add a guarded ViewDidLayoutSubviews check to detect self-sizing
content changes resolved during native layout, allowing the
CollectionView to shrink.
- Skip the post-layout check when content exceeds the current bounds in
the scrolling direction, without updating the cached content size. This
leaves growth detection to the pre-layout check and avoids the
nested-scroll regression.
- Refresh empty-source tracking when replacing ItemsSource so grouped
collections collapsed to zero can grow again, even when UIKit defers
data-source callbacks.
- Restore the required iOS and Mac Catalyst public API entries for the
layout callback override.


### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #38276

Related: #39847 — adds coverage to prevent reintroducing the
nested-scroll regression already addressed by the revert.

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
kubaflo added a commit that referenced this pull request Nov 16, 2026
…#40226)

<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, based on `41458556cf5d13573a632b83f89072f8badfb205`. No
retargeting or merging is requested.

### Description of Change

<!-- Enter description of the fix in this section -->

Fix the repeated iOS `Issue16320Test` regression without changing its
sample, assertions, timeouts, snapshots, or layout requests.

#39778 correctly prevents an unbounded cross-axis native probe from
returning the temporary 10,000-point frame as content height. However,
the horizontal fallback still resets height to zero. A horizontal
CollectionView in an Auto row, without an explicit
height/minimum/maximum, therefore never receives usable native bounds
and cannot realize its items. The unchanged UI test finds and taps
`Add`, then times out waiting for `item: 1`.

For horizontal **linear** CollectionViews that reach this unbounded
fallback, measure the first actual item's intrinsic height instead of
returning zero. Reuse normal templated-cell binding, including template
selection and binding context; skip empty leading groups; support the
native default cell when there is no template. Unbind and disconnect the
temporary template tree after measurement.

The native-probe guard and explicit/minimum/maximum constraint
resolution remain unchanged. Finite probes, vertical layouts,
CarouselView, grids, controller/scroll-update logic, and the original UI
test/sample are unchanged.

#### Native causal evidence

All local native runs used an isolated **iPhone 11 Pro CoreSimulator,
iOS 26.5**. Production source was rebuilt with the available **.NET SDK
11.0.100 / iOS SDK 27.2 / Xcode 27.2**. These are diagnostic source
builds, **not** a replay of the exact CI binary or validation of the
unavailable pinned Xcode 27.0 toolchain. No SDK-version check was
disabled.

| State | Actual native result |
| --- | --- |
| Original candidate | Unchanged `Issue16320Test` fails at line 22 after
tapping Add. |
| Causal control: remove only the unbounded-probe guard | Original UI
test passes 1/1; this control is not included in the fix. |
| Intended correction | Original UI test passes 3/3; focused device
sizing suite passes 18/18. |
| Restore the exact original production file, retain new tests | All 3
new cases fail at height 0; all 15 existing constraint/probe cases pass.
|
| Restore the correction | Focused device sizing suite passes 18/18
again. |

The three new device cases cover bound templates, grouping with an empty
leading group, and default/native content. Heights are compared with
actual label measurements, without fixed-height requests; each case
repeats measurement and verifies native-frame restoration. Existing
#39778 tests remain unchanged and passing.

Executed the unchanged UI oracle with:

```sh
dotnet test src/Controls/tests/TestCases.iOS.Tests/Controls.TestCases.iOS.Tests.csproj -f net11.0 -c Debug --no-build --no-restore --filter 'FullyQualifiedName~Issue16320Test'
```

Passed 3/3 against the correction, with `DEVICE_UDID` targeting the
isolated simulator and `HEADLESS=true`. Native XHarness ran these exact
discovered method selectors:

```text
[CollectionView] [NavigationRenderer] HorizontalCollectionViewPreMountHeightMeasuresContent
[CollectionView] [NavigationRenderer] HorizontalCollectionViewPreMountHeightRespectsConstraints
[CollectionView] [NavigationRenderer] VerticalCollectionViewPreMountWidthRespectsConstraints
[CollectionView] [NavigationRenderer] VerticalCollectionViewPreMountHeightMeasuresContent
```

The device diagnostic runner used a session-only standard scene manifest
and registered subclass of the existing test scene delegate; scene
validation stayed enabled. Its pre-existing obsolete legacy-handler
warning was nonfatal (`WarningsNotAsErrors=CS0618`). None of these
diagnostic provisioning files/settings are committed.

Formatting passed with:

```sh
dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Controls/src/Core/Handlers/Items2/ItemsViewHandler2.iOS.cs src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.iOS.cs --verbosity quiet
```

Exact pinned-toolchain CI and Mac Catalyst runtime validation are still
pending. Open and recently merged sizing PRs were checked: this corrects
#39778 rather than duplicating it or reverting its protection; #39882's
controller/shrinking logic and open #39935's header-resizing work are
not changed.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Relates to #40116 and #16320. Corrects the candidate regression
introduced by #39778 while preserving its fix for #39770.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo pushed a commit that referenced this pull request Nov 16, 2026
…ed scrolling (#39882)

<!-- 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!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Description of Change

<!-- Enter description of the fix in this section -->

Fix CollectionView height updates after replacing ItemsSource with fewer
items on iOS and Mac Catalyst, while preserving sizing behavior when
CollectionView is nested inside ScrollView.

In #38276, CollectionView retains its previously rendered
height after the item count decreases, leaving unused space and stale
Height/SizeChanged values. The previous fix, #38441, moved
content-size checking exclusively to ViewDidLayoutSubviews. This
introduced the nested-scroll regression reported in #39847:
the CollectionView could remain smaller than its content, creating an
additional vertical scroll range inside the outer ScrollView. That fix
was reverted by #39856.

This replacement builds on the reverted implementation:

- Preserve the existing ViewWillLayoutSubviews content-size check.
- Add a guarded ViewDidLayoutSubviews check to detect self-sizing
content changes resolved during native layout, allowing the
CollectionView to shrink.
- Skip the post-layout check when content exceeds the current bounds in
the scrolling direction, without updating the cached content size. This
leaves growth detection to the pre-layout check and avoids the
nested-scroll regression.
- Refresh empty-source tracking when replacing ItemsSource so grouped
collections collapsed to zero can grow again, even when UIKit defers
data-source callbacks.
- Restore the required iOS and Mac Catalyst public API entries for the
layout callback override.


### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #38276

Related: #39847 — adds coverage to prevent reintroducing the
nested-scroll regression already addressed by the revert.

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
kubaflo added a commit that referenced this pull request Nov 16, 2026
…#40226)

<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, based on `41458556cf5d13573a632b83f89072f8badfb205`. No
retargeting or merging is requested.

### Description of Change

<!-- Enter description of the fix in this section -->

Fix the repeated iOS `Issue16320Test` regression without changing its
sample, assertions, timeouts, snapshots, or layout requests.

#39778 correctly prevents an unbounded cross-axis native probe from
returning the temporary 10,000-point frame as content height. However,
the horizontal fallback still resets height to zero. A horizontal
CollectionView in an Auto row, without an explicit
height/minimum/maximum, therefore never receives usable native bounds
and cannot realize its items. The unchanged UI test finds and taps
`Add`, then times out waiting for `item: 1`.

For horizontal **linear** CollectionViews that reach this unbounded
fallback, measure the first actual item's intrinsic height instead of
returning zero. Reuse normal templated-cell binding, including template
selection and binding context; skip empty leading groups; support the
native default cell when there is no template. Unbind and disconnect the
temporary template tree after measurement.

The native-probe guard and explicit/minimum/maximum constraint
resolution remain unchanged. Finite probes, vertical layouts,
CarouselView, grids, controller/scroll-update logic, and the original UI
test/sample are unchanged.

#### Native causal evidence

All local native runs used an isolated **iPhone 11 Pro CoreSimulator,
iOS 26.5**. Production source was rebuilt with the available **.NET SDK
11.0.100 / iOS SDK 27.2 / Xcode 27.2**. These are diagnostic source
builds, **not** a replay of the exact CI binary or validation of the
unavailable pinned Xcode 27.0 toolchain. No SDK-version check was
disabled.

| State | Actual native result |
| --- | --- |
| Original candidate | Unchanged `Issue16320Test` fails at line 22 after
tapping Add. |
| Causal control: remove only the unbounded-probe guard | Original UI
test passes 1/1; this control is not included in the fix. |
| Intended correction | Original UI test passes 3/3; focused device
sizing suite passes 18/18. |
| Restore the exact original production file, retain new tests | All 3
new cases fail at height 0; all 15 existing constraint/probe cases pass.
|
| Restore the correction | Focused device sizing suite passes 18/18
again. |

The three new device cases cover bound templates, grouping with an empty
leading group, and default/native content. Heights are compared with
actual label measurements, without fixed-height requests; each case
repeats measurement and verifies native-frame restoration. Existing
#39778 tests remain unchanged and passing.

Executed the unchanged UI oracle with:

```sh
dotnet test src/Controls/tests/TestCases.iOS.Tests/Controls.TestCases.iOS.Tests.csproj -f net11.0 -c Debug --no-build --no-restore --filter 'FullyQualifiedName~Issue16320Test'
```

Passed 3/3 against the correction, with `DEVICE_UDID` targeting the
isolated simulator and `HEADLESS=true`. Native XHarness ran these exact
discovered method selectors:

```text
[CollectionView] [NavigationRenderer] HorizontalCollectionViewPreMountHeightMeasuresContent
[CollectionView] [NavigationRenderer] HorizontalCollectionViewPreMountHeightRespectsConstraints
[CollectionView] [NavigationRenderer] VerticalCollectionViewPreMountWidthRespectsConstraints
[CollectionView] [NavigationRenderer] VerticalCollectionViewPreMountHeightMeasuresContent
```

The device diagnostic runner used a session-only standard scene manifest
and registered subclass of the existing test scene delegate; scene
validation stayed enabled. Its pre-existing obsolete legacy-handler
warning was nonfatal (`WarningsNotAsErrors=CS0618`). None of these
diagnostic provisioning files/settings are committed.

Formatting passed with:

```sh
dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Controls/src/Core/Handlers/Items2/ItemsViewHandler2.iOS.cs src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.iOS.cs --verbosity quiet
```

Exact pinned-toolchain CI and Mac Catalyst runtime validation are still
pending. Open and recently merged sizing PRs were checked: this corrects
#39778 rather than duplicating it or reverting its protection; #39882's
controller/shrinking logic and open #39935's header-resizing work are
not changed.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Relates to #40116 and #16320. Corrects the candidate regression
introduced by #39778 while preserving its fix for #39770.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo pushed a commit that referenced this pull request Nov 17, 2026
…ed scrolling (#39882)

<!-- 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!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Description of Change

<!-- Enter description of the fix in this section -->

Fix CollectionView height updates after replacing ItemsSource with fewer
items on iOS and Mac Catalyst, while preserving sizing behavior when
CollectionView is nested inside ScrollView.

In #38276, CollectionView retains its previously rendered
height after the item count decreases, leaving unused space and stale
Height/SizeChanged values. The previous fix, #38441, moved
content-size checking exclusively to ViewDidLayoutSubviews. This
introduced the nested-scroll regression reported in #39847:
the CollectionView could remain smaller than its content, creating an
additional vertical scroll range inside the outer ScrollView. That fix
was reverted by #39856.

This replacement builds on the reverted implementation:

- Preserve the existing ViewWillLayoutSubviews content-size check.
- Add a guarded ViewDidLayoutSubviews check to detect self-sizing
content changes resolved during native layout, allowing the
CollectionView to shrink.
- Skip the post-layout check when content exceeds the current bounds in
the scrolling direction, without updating the cached content size. This
leaves growth detection to the pre-layout check and avoids the
nested-scroll regression.
- Refresh empty-source tracking when replacing ItemsSource so grouped
collections collapsed to zero can grow again, even when UIKit defers
data-source callbacks.
- Restore the required iOS and Mac Catalyst public API entries for the
layout callback override.


### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #38276

Related: #39847 — adds coverage to prevent reintroducing the
nested-scroll regression already addressed by the revert.

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
kubaflo added a commit that referenced this pull request Nov 17, 2026
…#40226)

<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, based on `41458556cf5d13573a632b83f89072f8badfb205`. No
retargeting or merging is requested.

### Description of Change

<!-- Enter description of the fix in this section -->

Fix the repeated iOS `Issue16320Test` regression without changing its
sample, assertions, timeouts, snapshots, or layout requests.

#39778 correctly prevents an unbounded cross-axis native probe from
returning the temporary 10,000-point frame as content height. However,
the horizontal fallback still resets height to zero. A horizontal
CollectionView in an Auto row, without an explicit
height/minimum/maximum, therefore never receives usable native bounds
and cannot realize its items. The unchanged UI test finds and taps
`Add`, then times out waiting for `item: 1`.

For horizontal **linear** CollectionViews that reach this unbounded
fallback, measure the first actual item's intrinsic height instead of
returning zero. Reuse normal templated-cell binding, including template
selection and binding context; skip empty leading groups; support the
native default cell when there is no template. Unbind and disconnect the
temporary template tree after measurement.

The native-probe guard and explicit/minimum/maximum constraint
resolution remain unchanged. Finite probes, vertical layouts,
CarouselView, grids, controller/scroll-update logic, and the original UI
test/sample are unchanged.

#### Native causal evidence

All local native runs used an isolated **iPhone 11 Pro CoreSimulator,
iOS 26.5**. Production source was rebuilt with the available **.NET SDK
11.0.100 / iOS SDK 27.2 / Xcode 27.2**. These are diagnostic source
builds, **not** a replay of the exact CI binary or validation of the
unavailable pinned Xcode 27.0 toolchain. No SDK-version check was
disabled.

| State | Actual native result |
| --- | --- |
| Original candidate | Unchanged `Issue16320Test` fails at line 22 after
tapping Add. |
| Causal control: remove only the unbounded-probe guard | Original UI
test passes 1/1; this control is not included in the fix. |
| Intended correction | Original UI test passes 3/3; focused device
sizing suite passes 18/18. |
| Restore the exact original production file, retain new tests | All 3
new cases fail at height 0; all 15 existing constraint/probe cases pass.
|
| Restore the correction | Focused device sizing suite passes 18/18
again. |

The three new device cases cover bound templates, grouping with an empty
leading group, and default/native content. Heights are compared with
actual label measurements, without fixed-height requests; each case
repeats measurement and verifies native-frame restoration. Existing
#39778 tests remain unchanged and passing.

Executed the unchanged UI oracle with:

```sh
dotnet test src/Controls/tests/TestCases.iOS.Tests/Controls.TestCases.iOS.Tests.csproj -f net11.0 -c Debug --no-build --no-restore --filter 'FullyQualifiedName~Issue16320Test'
```

Passed 3/3 against the correction, with `DEVICE_UDID` targeting the
isolated simulator and `HEADLESS=true`. Native XHarness ran these exact
discovered method selectors:

```text
[CollectionView] [NavigationRenderer] HorizontalCollectionViewPreMountHeightMeasuresContent
[CollectionView] [NavigationRenderer] HorizontalCollectionViewPreMountHeightRespectsConstraints
[CollectionView] [NavigationRenderer] VerticalCollectionViewPreMountWidthRespectsConstraints
[CollectionView] [NavigationRenderer] VerticalCollectionViewPreMountHeightMeasuresContent
```

The device diagnostic runner used a session-only standard scene manifest
and registered subclass of the existing test scene delegate; scene
validation stayed enabled. Its pre-existing obsolete legacy-handler
warning was nonfatal (`WarningsNotAsErrors=CS0618`). None of these
diagnostic provisioning files/settings are committed.

Formatting passed with:

```sh
dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Controls/src/Core/Handlers/Items2/ItemsViewHandler2.iOS.cs src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.iOS.cs --verbosity quiet
```

Exact pinned-toolchain CI and Mac Catalyst runtime validation are still
pending. Open and recently merged sizing PRs were checked: this corrects
#39778 rather than duplicating it or reverting its protection; #39882's
controller/shrinking logic and open #39935's header-resizing work are
not changed.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Relates to #40116 and #16320. Corrects the candidate regression
introduced by #39778 while preserving its fix for #39770.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo pushed a commit that referenced this pull request Nov 18, 2026
…ed scrolling (#39882)

<!-- 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!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Description of Change

<!-- Enter description of the fix in this section -->

Fix CollectionView height updates after replacing ItemsSource with fewer
items on iOS and Mac Catalyst, while preserving sizing behavior when
CollectionView is nested inside ScrollView.

In #38276, CollectionView retains its previously rendered
height after the item count decreases, leaving unused space and stale
Height/SizeChanged values. The previous fix, #38441, moved
content-size checking exclusively to ViewDidLayoutSubviews. This
introduced the nested-scroll regression reported in #39847:
the CollectionView could remain smaller than its content, creating an
additional vertical scroll range inside the outer ScrollView. That fix
was reverted by #39856.

This replacement builds on the reverted implementation:

- Preserve the existing ViewWillLayoutSubviews content-size check.
- Add a guarded ViewDidLayoutSubviews check to detect self-sizing
content changes resolved during native layout, allowing the
CollectionView to shrink.
- Skip the post-layout check when content exceeds the current bounds in
the scrolling direction, without updating the cached content size. This
leaves growth detection to the pre-layout check and avoids the
nested-scroll regression.
- Refresh empty-source tracking when replacing ItemsSource so grouped
collections collapsed to zero can grow again, even when UIKit defers
data-source callbacks.
- Restore the required iOS and Mac Catalyst public API entries for the
layout callback override.


### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #38276

Related: #39847 — adds coverage to prevent reintroducing the
nested-scroll regression already addressed by the revert.

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
kubaflo added a commit that referenced this pull request Nov 18, 2026
…#40226)

<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, based on `41458556cf5d13573a632b83f89072f8badfb205`. No
retargeting or merging is requested.

### Description of Change

<!-- Enter description of the fix in this section -->

Fix the repeated iOS `Issue16320Test` regression without changing its
sample, assertions, timeouts, snapshots, or layout requests.

#39778 correctly prevents an unbounded cross-axis native probe from
returning the temporary 10,000-point frame as content height. However,
the horizontal fallback still resets height to zero. A horizontal
CollectionView in an Auto row, without an explicit
height/minimum/maximum, therefore never receives usable native bounds
and cannot realize its items. The unchanged UI test finds and taps
`Add`, then times out waiting for `item: 1`.

For horizontal **linear** CollectionViews that reach this unbounded
fallback, measure the first actual item's intrinsic height instead of
returning zero. Reuse normal templated-cell binding, including template
selection and binding context; skip empty leading groups; support the
native default cell when there is no template. Unbind and disconnect the
temporary template tree after measurement.

The native-probe guard and explicit/minimum/maximum constraint
resolution remain unchanged. Finite probes, vertical layouts,
CarouselView, grids, controller/scroll-update logic, and the original UI
test/sample are unchanged.

#### Native causal evidence

All local native runs used an isolated **iPhone 11 Pro CoreSimulator,
iOS 26.5**. Production source was rebuilt with the available **.NET SDK
11.0.100 / iOS SDK 27.2 / Xcode 27.2**. These are diagnostic source
builds, **not** a replay of the exact CI binary or validation of the
unavailable pinned Xcode 27.0 toolchain. No SDK-version check was
disabled.

| State | Actual native result |
| --- | --- |
| Original candidate | Unchanged `Issue16320Test` fails at line 22 after
tapping Add. |
| Causal control: remove only the unbounded-probe guard | Original UI
test passes 1/1; this control is not included in the fix. |
| Intended correction | Original UI test passes 3/3; focused device
sizing suite passes 18/18. |
| Restore the exact original production file, retain new tests | All 3
new cases fail at height 0; all 15 existing constraint/probe cases pass.
|
| Restore the correction | Focused device sizing suite passes 18/18
again. |

The three new device cases cover bound templates, grouping with an empty
leading group, and default/native content. Heights are compared with
actual label measurements, without fixed-height requests; each case
repeats measurement and verifies native-frame restoration. Existing
#39778 tests remain unchanged and passing.

Executed the unchanged UI oracle with:

```sh
dotnet test src/Controls/tests/TestCases.iOS.Tests/Controls.TestCases.iOS.Tests.csproj -f net11.0 -c Debug --no-build --no-restore --filter 'FullyQualifiedName~Issue16320Test'
```

Passed 3/3 against the correction, with `DEVICE_UDID` targeting the
isolated simulator and `HEADLESS=true`. Native XHarness ran these exact
discovered method selectors:

```text
[CollectionView] [NavigationRenderer] HorizontalCollectionViewPreMountHeightMeasuresContent
[CollectionView] [NavigationRenderer] HorizontalCollectionViewPreMountHeightRespectsConstraints
[CollectionView] [NavigationRenderer] VerticalCollectionViewPreMountWidthRespectsConstraints
[CollectionView] [NavigationRenderer] VerticalCollectionViewPreMountHeightMeasuresContent
```

The device diagnostic runner used a session-only standard scene manifest
and registered subclass of the existing test scene delegate; scene
validation stayed enabled. Its pre-existing obsolete legacy-handler
warning was nonfatal (`WarningsNotAsErrors=CS0618`). None of these
diagnostic provisioning files/settings are committed.

Formatting passed with:

```sh
dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Controls/src/Core/Handlers/Items2/ItemsViewHandler2.iOS.cs src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.iOS.cs --verbosity quiet
```

Exact pinned-toolchain CI and Mac Catalyst runtime validation are still
pending. Open and recently merged sizing PRs were checked: this corrects
#39778 rather than duplicating it or reverting its protection; #39882's
controller/shrinking logic and open #39935's header-resizing work are
not changed.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Relates to #40116 and #16320. Corrects the candidate regression
introduced by #39778 while preserving its fix for #39770.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo pushed a commit that referenced this pull request Nov 18, 2026
…ed scrolling (#39882)

<!-- 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!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Description of Change

<!-- Enter description of the fix in this section -->

Fix CollectionView height updates after replacing ItemsSource with fewer
items on iOS and Mac Catalyst, while preserving sizing behavior when
CollectionView is nested inside ScrollView.

In #38276, CollectionView retains its previously rendered
height after the item count decreases, leaving unused space and stale
Height/SizeChanged values. The previous fix, #38441, moved
content-size checking exclusively to ViewDidLayoutSubviews. This
introduced the nested-scroll regression reported in #39847:
the CollectionView could remain smaller than its content, creating an
additional vertical scroll range inside the outer ScrollView. That fix
was reverted by #39856.

This replacement builds on the reverted implementation:

- Preserve the existing ViewWillLayoutSubviews content-size check.
- Add a guarded ViewDidLayoutSubviews check to detect self-sizing
content changes resolved during native layout, allowing the
CollectionView to shrink.
- Skip the post-layout check when content exceeds the current bounds in
the scrolling direction, without updating the cached content size. This
leaves growth detection to the pre-layout check and avoids the
nested-scroll regression.
- Refresh empty-source tracking when replacing ItemsSource so grouped
collections collapsed to zero can grow again, even when UIKit defers
data-source callbacks.
- Restore the required iOS and Mac Catalyst public API entries for the
layout callback override.


### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #38276

Related: #39847 — adds coverage to prevent reintroducing the
nested-scroll regression already addressed by the revert.

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
kubaflo added a commit that referenced this pull request Nov 18, 2026
…#40226)

<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, based on `41458556cf5d13573a632b83f89072f8badfb205`. No
retargeting or merging is requested.

### Description of Change

<!-- Enter description of the fix in this section -->

Fix the repeated iOS `Issue16320Test` regression without changing its
sample, assertions, timeouts, snapshots, or layout requests.

#39778 correctly prevents an unbounded cross-axis native probe from
returning the temporary 10,000-point frame as content height. However,
the horizontal fallback still resets height to zero. A horizontal
CollectionView in an Auto row, without an explicit
height/minimum/maximum, therefore never receives usable native bounds
and cannot realize its items. The unchanged UI test finds and taps
`Add`, then times out waiting for `item: 1`.

For horizontal **linear** CollectionViews that reach this unbounded
fallback, measure the first actual item's intrinsic height instead of
returning zero. Reuse normal templated-cell binding, including template
selection and binding context; skip empty leading groups; support the
native default cell when there is no template. Unbind and disconnect the
temporary template tree after measurement.

The native-probe guard and explicit/minimum/maximum constraint
resolution remain unchanged. Finite probes, vertical layouts,
CarouselView, grids, controller/scroll-update logic, and the original UI
test/sample are unchanged.

#### Native causal evidence

All local native runs used an isolated **iPhone 11 Pro CoreSimulator,
iOS 26.5**. Production source was rebuilt with the available **.NET SDK
11.0.100 / iOS SDK 27.2 / Xcode 27.2**. These are diagnostic source
builds, **not** a replay of the exact CI binary or validation of the
unavailable pinned Xcode 27.0 toolchain. No SDK-version check was
disabled.

| State | Actual native result |
| --- | --- |
| Original candidate | Unchanged `Issue16320Test` fails at line 22 after
tapping Add. |
| Causal control: remove only the unbounded-probe guard | Original UI
test passes 1/1; this control is not included in the fix. |
| Intended correction | Original UI test passes 3/3; focused device
sizing suite passes 18/18. |
| Restore the exact original production file, retain new tests | All 3
new cases fail at height 0; all 15 existing constraint/probe cases pass.
|
| Restore the correction | Focused device sizing suite passes 18/18
again. |

The three new device cases cover bound templates, grouping with an empty
leading group, and default/native content. Heights are compared with
actual label measurements, without fixed-height requests; each case
repeats measurement and verifies native-frame restoration. Existing
#39778 tests remain unchanged and passing.

Executed the unchanged UI oracle with:

```sh
dotnet test src/Controls/tests/TestCases.iOS.Tests/Controls.TestCases.iOS.Tests.csproj -f net11.0 -c Debug --no-build --no-restore --filter 'FullyQualifiedName~Issue16320Test'
```

Passed 3/3 against the correction, with `DEVICE_UDID` targeting the
isolated simulator and `HEADLESS=true`. Native XHarness ran these exact
discovered method selectors:

```text
[CollectionView] [NavigationRenderer] HorizontalCollectionViewPreMountHeightMeasuresContent
[CollectionView] [NavigationRenderer] HorizontalCollectionViewPreMountHeightRespectsConstraints
[CollectionView] [NavigationRenderer] VerticalCollectionViewPreMountWidthRespectsConstraints
[CollectionView] [NavigationRenderer] VerticalCollectionViewPreMountHeightMeasuresContent
```

The device diagnostic runner used a session-only standard scene manifest
and registered subclass of the existing test scene delegate; scene
validation stayed enabled. Its pre-existing obsolete legacy-handler
warning was nonfatal (`WarningsNotAsErrors=CS0618`). None of these
diagnostic provisioning files/settings are committed.

Formatting passed with:

```sh
dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Controls/src/Core/Handlers/Items2/ItemsViewHandler2.iOS.cs src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.iOS.cs --verbosity quiet
```

Exact pinned-toolchain CI and Mac Catalyst runtime validation are still
pending. Open and recently merged sizing PRs were checked: this corrects
#39778 rather than duplicating it or reverting its protection; #39882's
controller/shrinking logic and open #39935's header-resizing work are
not changed.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Relates to #40116 and #16320. Corrects the candidate regression
introduced by #39778 while preserving its fix for #39770.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo pushed a commit that referenced this pull request Nov 18, 2026
…ed scrolling (#39882)

<!-- 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!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Description of Change

<!-- Enter description of the fix in this section -->

Fix CollectionView height updates after replacing ItemsSource with fewer
items on iOS and Mac Catalyst, while preserving sizing behavior when
CollectionView is nested inside ScrollView.

In #38276, CollectionView retains its previously rendered
height after the item count decreases, leaving unused space and stale
Height/SizeChanged values. The previous fix, #38441, moved
content-size checking exclusively to ViewDidLayoutSubviews. This
introduced the nested-scroll regression reported in #39847:
the CollectionView could remain smaller than its content, creating an
additional vertical scroll range inside the outer ScrollView. That fix
was reverted by #39856.

This replacement builds on the reverted implementation:

- Preserve the existing ViewWillLayoutSubviews content-size check.
- Add a guarded ViewDidLayoutSubviews check to detect self-sizing
content changes resolved during native layout, allowing the
CollectionView to shrink.
- Skip the post-layout check when content exceeds the current bounds in
the scrolling direction, without updating the cached content size. This
leaves growth detection to the pre-layout check and avoids the
nested-scroll regression.
- Refresh empty-source tracking when replacing ItemsSource so grouped
collections collapsed to zero can grow again, even when UIKit defers
data-source callbacks.
- Restore the required iOS and Mac Catalyst public API entries for the
layout callback override.


### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #38276

Related: #39847 — adds coverage to prevent reintroducing the
nested-scroll regression already addressed by the revert.

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
kubaflo added a commit that referenced this pull request Nov 18, 2026
…#40226)

<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, based on `41458556cf5d13573a632b83f89072f8badfb205`. No
retargeting or merging is requested.

### Description of Change

<!-- Enter description of the fix in this section -->

Fix the repeated iOS `Issue16320Test` regression without changing its
sample, assertions, timeouts, snapshots, or layout requests.

#39778 correctly prevents an unbounded cross-axis native probe from
returning the temporary 10,000-point frame as content height. However,
the horizontal fallback still resets height to zero. A horizontal
CollectionView in an Auto row, without an explicit
height/minimum/maximum, therefore never receives usable native bounds
and cannot realize its items. The unchanged UI test finds and taps
`Add`, then times out waiting for `item: 1`.

For horizontal **linear** CollectionViews that reach this unbounded
fallback, measure the first actual item's intrinsic height instead of
returning zero. Reuse normal templated-cell binding, including template
selection and binding context; skip empty leading groups; support the
native default cell when there is no template. Unbind and disconnect the
temporary template tree after measurement.

The native-probe guard and explicit/minimum/maximum constraint
resolution remain unchanged. Finite probes, vertical layouts,
CarouselView, grids, controller/scroll-update logic, and the original UI
test/sample are unchanged.

#### Native causal evidence

All local native runs used an isolated **iPhone 11 Pro CoreSimulator,
iOS 26.5**. Production source was rebuilt with the available **.NET SDK
11.0.100 / iOS SDK 27.2 / Xcode 27.2**. These are diagnostic source
builds, **not** a replay of the exact CI binary or validation of the
unavailable pinned Xcode 27.0 toolchain. No SDK-version check was
disabled.

| State | Actual native result |
| --- | --- |
| Original candidate | Unchanged `Issue16320Test` fails at line 22 after
tapping Add. |
| Causal control: remove only the unbounded-probe guard | Original UI
test passes 1/1; this control is not included in the fix. |
| Intended correction | Original UI test passes 3/3; focused device
sizing suite passes 18/18. |
| Restore the exact original production file, retain new tests | All 3
new cases fail at height 0; all 15 existing constraint/probe cases pass.
|
| Restore the correction | Focused device sizing suite passes 18/18
again. |

The three new device cases cover bound templates, grouping with an empty
leading group, and default/native content. Heights are compared with
actual label measurements, without fixed-height requests; each case
repeats measurement and verifies native-frame restoration. Existing
#39778 tests remain unchanged and passing.

Executed the unchanged UI oracle with:

```sh
dotnet test src/Controls/tests/TestCases.iOS.Tests/Controls.TestCases.iOS.Tests.csproj -f net11.0 -c Debug --no-build --no-restore --filter 'FullyQualifiedName~Issue16320Test'
```

Passed 3/3 against the correction, with `DEVICE_UDID` targeting the
isolated simulator and `HEADLESS=true`. Native XHarness ran these exact
discovered method selectors:

```text
[CollectionView] [NavigationRenderer] HorizontalCollectionViewPreMountHeightMeasuresContent
[CollectionView] [NavigationRenderer] HorizontalCollectionViewPreMountHeightRespectsConstraints
[CollectionView] [NavigationRenderer] VerticalCollectionViewPreMountWidthRespectsConstraints
[CollectionView] [NavigationRenderer] VerticalCollectionViewPreMountHeightMeasuresContent
```

The device diagnostic runner used a session-only standard scene manifest
and registered subclass of the existing test scene delegate; scene
validation stayed enabled. Its pre-existing obsolete legacy-handler
warning was nonfatal (`WarningsNotAsErrors=CS0618`). None of these
diagnostic provisioning files/settings are committed.

Formatting passed with:

```sh
dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Controls/src/Core/Handlers/Items2/ItemsViewHandler2.iOS.cs src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.iOS.cs --verbosity quiet
```

Exact pinned-toolchain CI and Mac Catalyst runtime validation are still
pending. Open and recently merged sizing PRs were checked: this corrects
#39778 rather than duplicating it or reverting its protection; #39882's
controller/shrinking logic and open #39935's header-resizing work are
not changed.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Relates to #40116 and #16320. Corrects the candidate regression
introduced by #39778 while preserving its fix for #39770.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo pushed a commit that referenced this pull request Nov 19, 2026
…ed scrolling (#39882)

<!-- 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!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Description of Change

<!-- Enter description of the fix in this section -->

Fix CollectionView height updates after replacing ItemsSource with fewer
items on iOS and Mac Catalyst, while preserving sizing behavior when
CollectionView is nested inside ScrollView.

In #38276, CollectionView retains its previously rendered
height after the item count decreases, leaving unused space and stale
Height/SizeChanged values. The previous fix, #38441, moved
content-size checking exclusively to ViewDidLayoutSubviews. This
introduced the nested-scroll regression reported in #39847:
the CollectionView could remain smaller than its content, creating an
additional vertical scroll range inside the outer ScrollView. That fix
was reverted by #39856.

This replacement builds on the reverted implementation:

- Preserve the existing ViewWillLayoutSubviews content-size check.
- Add a guarded ViewDidLayoutSubviews check to detect self-sizing
content changes resolved during native layout, allowing the
CollectionView to shrink.
- Skip the post-layout check when content exceeds the current bounds in
the scrolling direction, without updating the cached content size. This
leaves growth detection to the pre-layout check and avoids the
nested-scroll regression.
- Refresh empty-source tracking when replacing ItemsSource so grouped
collections collapsed to zero can grow again, even when UIKit defers
data-source callbacks.
- Restore the required iOS and Mac Catalyst public API entries for the
layout callback override.


### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #38276

Related: #39847 — adds coverage to prevent reintroducing the
nested-scroll regression already addressed by the revert.

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
kubaflo added a commit that referenced this pull request Nov 19, 2026
…#40226)

<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, based on `41458556cf5d13573a632b83f89072f8badfb205`. No
retargeting or merging is requested.

### Description of Change

<!-- Enter description of the fix in this section -->

Fix the repeated iOS `Issue16320Test` regression without changing its
sample, assertions, timeouts, snapshots, or layout requests.

#39778 correctly prevents an unbounded cross-axis native probe from
returning the temporary 10,000-point frame as content height. However,
the horizontal fallback still resets height to zero. A horizontal
CollectionView in an Auto row, without an explicit
height/minimum/maximum, therefore never receives usable native bounds
and cannot realize its items. The unchanged UI test finds and taps
`Add`, then times out waiting for `item: 1`.

For horizontal **linear** CollectionViews that reach this unbounded
fallback, measure the first actual item's intrinsic height instead of
returning zero. Reuse normal templated-cell binding, including template
selection and binding context; skip empty leading groups; support the
native default cell when there is no template. Unbind and disconnect the
temporary template tree after measurement.

The native-probe guard and explicit/minimum/maximum constraint
resolution remain unchanged. Finite probes, vertical layouts,
CarouselView, grids, controller/scroll-update logic, and the original UI
test/sample are unchanged.

#### Native causal evidence

All local native runs used an isolated **iPhone 11 Pro CoreSimulator,
iOS 26.5**. Production source was rebuilt with the available **.NET SDK
11.0.100 / iOS SDK 27.2 / Xcode 27.2**. These are diagnostic source
builds, **not** a replay of the exact CI binary or validation of the
unavailable pinned Xcode 27.0 toolchain. No SDK-version check was
disabled.

| State | Actual native result |
| --- | --- |
| Original candidate | Unchanged `Issue16320Test` fails at line 22 after
tapping Add. |
| Causal control: remove only the unbounded-probe guard | Original UI
test passes 1/1; this control is not included in the fix. |
| Intended correction | Original UI test passes 3/3; focused device
sizing suite passes 18/18. |
| Restore the exact original production file, retain new tests | All 3
new cases fail at height 0; all 15 existing constraint/probe cases pass.
|
| Restore the correction | Focused device sizing suite passes 18/18
again. |

The three new device cases cover bound templates, grouping with an empty
leading group, and default/native content. Heights are compared with
actual label measurements, without fixed-height requests; each case
repeats measurement and verifies native-frame restoration. Existing
#39778 tests remain unchanged and passing.

Executed the unchanged UI oracle with:

```sh
dotnet test src/Controls/tests/TestCases.iOS.Tests/Controls.TestCases.iOS.Tests.csproj -f net11.0 -c Debug --no-build --no-restore --filter 'FullyQualifiedName~Issue16320Test'
```

Passed 3/3 against the correction, with `DEVICE_UDID` targeting the
isolated simulator and `HEADLESS=true`. Native XHarness ran these exact
discovered method selectors:

```text
[CollectionView] [NavigationRenderer] HorizontalCollectionViewPreMountHeightMeasuresContent
[CollectionView] [NavigationRenderer] HorizontalCollectionViewPreMountHeightRespectsConstraints
[CollectionView] [NavigationRenderer] VerticalCollectionViewPreMountWidthRespectsConstraints
[CollectionView] [NavigationRenderer] VerticalCollectionViewPreMountHeightMeasuresContent
```

The device diagnostic runner used a session-only standard scene manifest
and registered subclass of the existing test scene delegate; scene
validation stayed enabled. Its pre-existing obsolete legacy-handler
warning was nonfatal (`WarningsNotAsErrors=CS0618`). None of these
diagnostic provisioning files/settings are committed.

Formatting passed with:

```sh
dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Controls/src/Core/Handlers/Items2/ItemsViewHandler2.iOS.cs src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.iOS.cs --verbosity quiet
```

Exact pinned-toolchain CI and Mac Catalyst runtime validation are still
pending. Open and recently merged sizing PRs were checked: this corrects
#39778 rather than duplicating it or reverting its protection; #39882's
controller/shrinking logic and open #39935's header-resizing work are
not changed.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Relates to #40116 and #16320. Corrects the candidate regression
introduced by #39778 while preserving its fix for #39770.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo pushed a commit that referenced this pull request Nov 22, 2026
…ed scrolling (#39882)

<!-- 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!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Description of Change

<!-- Enter description of the fix in this section -->

Fix CollectionView height updates after replacing ItemsSource with fewer
items on iOS and Mac Catalyst, while preserving sizing behavior when
CollectionView is nested inside ScrollView.

In #38276, CollectionView retains its previously rendered
height after the item count decreases, leaving unused space and stale
Height/SizeChanged values. The previous fix, #38441, moved
content-size checking exclusively to ViewDidLayoutSubviews. This
introduced the nested-scroll regression reported in #39847:
the CollectionView could remain smaller than its content, creating an
additional vertical scroll range inside the outer ScrollView. That fix
was reverted by #39856.

This replacement builds on the reverted implementation:

- Preserve the existing ViewWillLayoutSubviews content-size check.
- Add a guarded ViewDidLayoutSubviews check to detect self-sizing
content changes resolved during native layout, allowing the
CollectionView to shrink.
- Skip the post-layout check when content exceeds the current bounds in
the scrolling direction, without updating the cached content size. This
leaves growth detection to the pre-layout check and avoids the
nested-scroll regression.
- Refresh empty-source tracking when replacing ItemsSource so grouped
collections collapsed to zero can grow again, even when UIKit defers
data-source callbacks.
- Restore the required iOS and Mac Catalyst public API entries for the
layout callback override.


### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #38276

Related: #39847 — adds coverage to prevent reintroducing the
nested-scroll regression already addressed by the revert.

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
kubaflo added a commit that referenced this pull request Nov 22, 2026
…#40226)

<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, based on `41458556cf5d13573a632b83f89072f8badfb205`. No
retargeting or merging is requested.

### Description of Change

<!-- Enter description of the fix in this section -->

Fix the repeated iOS `Issue16320Test` regression without changing its
sample, assertions, timeouts, snapshots, or layout requests.

#39778 correctly prevents an unbounded cross-axis native probe from
returning the temporary 10,000-point frame as content height. However,
the horizontal fallback still resets height to zero. A horizontal
CollectionView in an Auto row, without an explicit
height/minimum/maximum, therefore never receives usable native bounds
and cannot realize its items. The unchanged UI test finds and taps
`Add`, then times out waiting for `item: 1`.

For horizontal **linear** CollectionViews that reach this unbounded
fallback, measure the first actual item's intrinsic height instead of
returning zero. Reuse normal templated-cell binding, including template
selection and binding context; skip empty leading groups; support the
native default cell when there is no template. Unbind and disconnect the
temporary template tree after measurement.

The native-probe guard and explicit/minimum/maximum constraint
resolution remain unchanged. Finite probes, vertical layouts,
CarouselView, grids, controller/scroll-update logic, and the original UI
test/sample are unchanged.

#### Native causal evidence

All local native runs used an isolated **iPhone 11 Pro CoreSimulator,
iOS 26.5**. Production source was rebuilt with the available **.NET SDK
11.0.100 / iOS SDK 27.2 / Xcode 27.2**. These are diagnostic source
builds, **not** a replay of the exact CI binary or validation of the
unavailable pinned Xcode 27.0 toolchain. No SDK-version check was
disabled.

| State | Actual native result |
| --- | --- |
| Original candidate | Unchanged `Issue16320Test` fails at line 22 after
tapping Add. |
| Causal control: remove only the unbounded-probe guard | Original UI
test passes 1/1; this control is not included in the fix. |
| Intended correction | Original UI test passes 3/3; focused device
sizing suite passes 18/18. |
| Restore the exact original production file, retain new tests | All 3
new cases fail at height 0; all 15 existing constraint/probe cases pass.
|
| Restore the correction | Focused device sizing suite passes 18/18
again. |

The three new device cases cover bound templates, grouping with an empty
leading group, and default/native content. Heights are compared with
actual label measurements, without fixed-height requests; each case
repeats measurement and verifies native-frame restoration. Existing
#39778 tests remain unchanged and passing.

Executed the unchanged UI oracle with:

```sh
dotnet test src/Controls/tests/TestCases.iOS.Tests/Controls.TestCases.iOS.Tests.csproj -f net11.0 -c Debug --no-build --no-restore --filter 'FullyQualifiedName~Issue16320Test'
```

Passed 3/3 against the correction, with `DEVICE_UDID` targeting the
isolated simulator and `HEADLESS=true`. Native XHarness ran these exact
discovered method selectors:

```text
[CollectionView] [NavigationRenderer] HorizontalCollectionViewPreMountHeightMeasuresContent
[CollectionView] [NavigationRenderer] HorizontalCollectionViewPreMountHeightRespectsConstraints
[CollectionView] [NavigationRenderer] VerticalCollectionViewPreMountWidthRespectsConstraints
[CollectionView] [NavigationRenderer] VerticalCollectionViewPreMountHeightMeasuresContent
```

The device diagnostic runner used a session-only standard scene manifest
and registered subclass of the existing test scene delegate; scene
validation stayed enabled. Its pre-existing obsolete legacy-handler
warning was nonfatal (`WarningsNotAsErrors=CS0618`). None of these
diagnostic provisioning files/settings are committed.

Formatting passed with:

```sh
dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Controls/src/Core/Handlers/Items2/ItemsViewHandler2.iOS.cs src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.iOS.cs --verbosity quiet
```

Exact pinned-toolchain CI and Mac Catalyst runtime validation are still
pending. Open and recently merged sizing PRs were checked: this corrects
#39778 rather than duplicating it or reverting its protection; #39882's
controller/shrinking logic and open #39935's header-resizing work are
not changed.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Relates to #40116 and #16320. Corrects the candidate regression
introduced by #39778 while preserving its fix for #39770.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo pushed a commit that referenced this pull request Nov 23, 2026
…ed scrolling (#39882)

<!-- 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!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Description of Change

<!-- Enter description of the fix in this section -->

Fix CollectionView height updates after replacing ItemsSource with fewer
items on iOS and Mac Catalyst, while preserving sizing behavior when
CollectionView is nested inside ScrollView.

In #38276, CollectionView retains its previously rendered
height after the item count decreases, leaving unused space and stale
Height/SizeChanged values. The previous fix, #38441, moved
content-size checking exclusively to ViewDidLayoutSubviews. This
introduced the nested-scroll regression reported in #39847:
the CollectionView could remain smaller than its content, creating an
additional vertical scroll range inside the outer ScrollView. That fix
was reverted by #39856.

This replacement builds on the reverted implementation:

- Preserve the existing ViewWillLayoutSubviews content-size check.
- Add a guarded ViewDidLayoutSubviews check to detect self-sizing
content changes resolved during native layout, allowing the
CollectionView to shrink.
- Skip the post-layout check when content exceeds the current bounds in
the scrolling direction, without updating the cached content size. This
leaves growth detection to the pre-layout check and avoids the
nested-scroll regression.
- Refresh empty-source tracking when replacing ItemsSource so grouped
collections collapsed to zero can grow again, even when UIKit defers
data-source callbacks.
- Restore the required iOS and Mac Catalyst public API entries for the
layout callback override.


### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #38276

Related: #39847 — adds coverage to prevent reintroducing the
nested-scroll regression already addressed by the revert.

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
kubaflo added a commit that referenced this pull request Nov 23, 2026
…#40226)

<!-- 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!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

This is explicitly coordinated stabilization of `candidate/11.0.1xx-sr2`
for #40116, based on `41458556cf5d13573a632b83f89072f8badfb205`. No
retargeting or merging is requested.

### Description of Change

<!-- Enter description of the fix in this section -->

Fix the repeated iOS `Issue16320Test` regression without changing its
sample, assertions, timeouts, snapshots, or layout requests.

#39778 correctly prevents an unbounded cross-axis native probe from
returning the temporary 10,000-point frame as content height. However,
the horizontal fallback still resets height to zero. A horizontal
CollectionView in an Auto row, without an explicit
height/minimum/maximum, therefore never receives usable native bounds
and cannot realize its items. The unchanged UI test finds and taps
`Add`, then times out waiting for `item: 1`.

For horizontal **linear** CollectionViews that reach this unbounded
fallback, measure the first actual item's intrinsic height instead of
returning zero. Reuse normal templated-cell binding, including template
selection and binding context; skip empty leading groups; support the
native default cell when there is no template. Unbind and disconnect the
temporary template tree after measurement.

The native-probe guard and explicit/minimum/maximum constraint
resolution remain unchanged. Finite probes, vertical layouts,
CarouselView, grids, controller/scroll-update logic, and the original UI
test/sample are unchanged.

#### Native causal evidence

All local native runs used an isolated **iPhone 11 Pro CoreSimulator,
iOS 26.5**. Production source was rebuilt with the available **.NET SDK
11.0.100 / iOS SDK 27.2 / Xcode 27.2**. These are diagnostic source
builds, **not** a replay of the exact CI binary or validation of the
unavailable pinned Xcode 27.0 toolchain. No SDK-version check was
disabled.

| State | Actual native result |
| --- | --- |
| Original candidate | Unchanged `Issue16320Test` fails at line 22 after
tapping Add. |
| Causal control: remove only the unbounded-probe guard | Original UI
test passes 1/1; this control is not included in the fix. |
| Intended correction | Original UI test passes 3/3; focused device
sizing suite passes 18/18. |
| Restore the exact original production file, retain new tests | All 3
new cases fail at height 0; all 15 existing constraint/probe cases pass.
|
| Restore the correction | Focused device sizing suite passes 18/18
again. |

The three new device cases cover bound templates, grouping with an empty
leading group, and default/native content. Heights are compared with
actual label measurements, without fixed-height requests; each case
repeats measurement and verifies native-frame restoration. Existing
#39778 tests remain unchanged and passing.

Executed the unchanged UI oracle with:

```sh
dotnet test src/Controls/tests/TestCases.iOS.Tests/Controls.TestCases.iOS.Tests.csproj -f net11.0 -c Debug --no-build --no-restore --filter 'FullyQualifiedName~Issue16320Test'
```

Passed 3/3 against the correction, with `DEVICE_UDID` targeting the
isolated simulator and `HEADLESS=true`. Native XHarness ran these exact
discovered method selectors:

```text
[CollectionView] [NavigationRenderer] HorizontalCollectionViewPreMountHeightMeasuresContent
[CollectionView] [NavigationRenderer] HorizontalCollectionViewPreMountHeightRespectsConstraints
[CollectionView] [NavigationRenderer] VerticalCollectionViewPreMountWidthRespectsConstraints
[CollectionView] [NavigationRenderer] VerticalCollectionViewPreMountHeightMeasuresContent
```

The device diagnostic runner used a session-only standard scene manifest
and registered subclass of the existing test scene delegate; scene
validation stayed enabled. Its pre-existing obsolete legacy-handler
warning was nonfatal (`WarningsNotAsErrors=CS0618`). None of these
diagnostic provisioning files/settings are committed.

Formatting passed with:

```sh
dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Controls/src/Core/Handlers/Items2/ItemsViewHandler2.iOS.cs src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.iOS.cs --verbosity quiet
```

Exact pinned-toolchain CI and Mac Catalyst runtime validation are still
pending. Open and recently merged sizing PRs were checked: this corrects
#39778 rather than duplicating it or reverting its protection; #39882's
controller/shrinking logic and open #39935's header-resizing work are
not changed.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Relates to #40116 and #16320. Corrects the candidate regression
introduced by #39778 while preserving its fix for #39770.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-controls-collectionview CollectionView, CarouselView, IndicatorView community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/ios platform/macos macOS / Mac Catalyst

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Mac][iOS] CollectionView does not shrink its rendered height after ItemsSource is updated with fewer items

4 participants