Skip to content

[iOS/Mac][Revert] CollectionView2 height-update fix (#38441) - #39856

Merged
kubaflo merged 1 commit into
dotnet:mainfrom
SyedAbdulAzeemSF4852:revert-38441
Nov 3, 2026
Merged

kubaflo merged 1 commit into
dotnet:mainfrom
SyedAbdulAzeemSF4852:revert-38441

Conversation

@SyedAbdulAzeemSF4852

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

  • Reverts all changes introduced by [iOS/Mac] Fix CollectionView2 height not updating when ItemsSource changes #38441 to address the iOS nested-scrolling regression reported in [NET 10] N_ScrollView - There are 2 vertical scrollbars on N1 and N4 for iOS #39847.
  • The original change moved the content-size check from ViewWillLayoutSubviews() to ViewDidLayoutSubviews(). With this timing change, the existing bounds-based condition could skip remeasurement when both the previous and updated content heights exceeded the CollectionView's current bounds. This could leave the CollectionView independently scrollable inside its parent ScrollView, producing two vertical scrollbars.
  • This revert restores the check to ViewWillLayoutSubviews(), removes the added ViewDidLayoutSubviews() override and its iOS/MacCatalyst API entries, and removes the four test/sample files introduced by the original PR.

Issues Fixed

Fixes #39847

Output

Before After
Before_Output.mov
After.mov

@SyedAbdulAzeemSF4852
SyedAbdulAzeemSF4852 marked this pull request as ready for review November 3, 2026 16:07
Copilot AI balanced review requested due to automatic review settings November 3, 2026 16:07
@github-actions

github-actions Bot commented Nov 3, 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 -- 39856

Or

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

@azure-pipelines

This comment has been minimized.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Hey there @@SyedAbdulAzeemSF4852! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service dotnet-policy-service Bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Nov 3, 2026
@kubaflo
kubaflo merged commit 82b9930 into dotnet:main Nov 3, 2026
10 of 20 checks passed

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

Human validation on iOS/MacCatalyst is needed to weigh the nested-scrolling fix against the restored height-update limitation and shared-controller impact, especially with the original transition tests removed.

No open issues 🎉

What changed in this PR

Reverts #38441 in the iOS/MacCatalyst CollectionView2 handler to address the nested-scrolling regression reported in #39847, where a CollectionView inside a ScrollView displays a second vertical scrollbar.

Changes:

  • Restores content-size checking to ViewWillLayoutSubviews() and removes the ViewDidLayoutSubviews() override.
  • Removes the corresponding iOS and MacCatalyst API entries.
  • Deletes the two test pages and two UI test files introduced by the reverted change.
File Description
src/​Controls/​tests/​TestCases.Shared.Tests/​Tests/​Issues/​Issue38276.cs Removes height-update and empty-transition UI tests.
src/​Controls/​tests/​TestCases.Shared.Tests/​Tests/​Issues/​Issue38276_Grouped.cs Removes grouped height-update UI test.
src/​Controls/​tests/​TestCases.HostApp/​Issues/​Issue38276.cs Removes the ungrouped height-update test page.
src/​Controls/​tests/​TestCases.HostApp/​Issues/​Issue38276_Grouped.cs Removes the grouped height-update test page.
src/​Controls/​src/​Core/​PublicAPI/​net-maccatalyst/​PublicAPI.Unshipped.txt Removes the MacCatalyst override API entry.
src/​Controls/​src/​Core/​PublicAPI/​net-ios/​PublicAPI.Unshipped.txt Removes the iOS override API entry.
src/​Controls/​src/​Core/​Handlers/​Items2/​iOS/​ItemsViewController2.cs Restores pre-layout content-size checking.

Review effort: Balanced

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

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — 96da8971 Deployed Nov 3, 2026 by SyedAbdulAzeemSF4852 via conclusion #2660
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[NET 10] N_ScrollView - There are 2 vertical scrollbars on N1 and N4 for iOS

3 participants