Skip to content

Conversation

@karthikraja-arumugam
Copy link
Contributor

Issue Details

In the Developer Balance sample, the CollectionView items appear larger than expected on iOS and Mac. Additional vertical space is observed within the cards.

Root Cause

Breaking PR: #30978
In that PR, when the content size isn’t set, the desired size of the CollectionView is used. This causes the issue when a horizontal CollectionView stretches to full size without resizing to its actual height.

Description of change

Instead of returning the desired size from the base, the content size is now updated based on the CollectionView orientation, ensuring proper size constraints are applied

Validated the behaviour in the following platforms

  • Android
  • iOS
  • MacOS
  • Windows

Issues Fixed

Fixes #31897

Screenshots

Before After
image image

Copilot AI review requested due to automatic review settings October 7, 2025 13:59
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Oct 7, 2025
@dotnet-policy-service
Copy link
Contributor

Hey there @@karthikraja-arumugam! 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 Oct 7, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request fixes a layout issue in CollectionView where cards appeared larger than expected on iOS and Mac platforms. The issue was caused by incorrect sizing behavior when content size wasn't initially available.

Key changes:

  • Modified the sizing logic to consider CollectionView orientation when determining content size
  • Added scroll direction awareness to prevent incorrect sizing in horizontal layouts
  • Included comprehensive UI tests to validate the fix

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/Controls/src/Core/Handlers/Items2/ItemsViewHandler2.iOS.cs Updated GetDesiredSize method to handle orientation-aware sizing logic
src/Controls/src/Core/Handlers/Items2/iOS/ItemsViewController2.cs Added GetScrollDirection method to expose CollectionView orientation
src/Controls/tests/TestCases.HostApp/Issues/Issue31897.cs Created UI test page with horizontal CollectionView to reproduce the issue
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue31897.cs Added automated test to verify CollectionView height behavior

@karthikraja-arumugam karthikraja-arumugam changed the title Issue31897 [iOS, Catalyst] Fixed CollectionView items height appears larger in Developer Balance sample Oct 7, 2025
@karthikraja-arumugam
Copy link
Contributor Author

@dotnet-policy-service agree company="Syncfusion, Inc."

@karthikraja-arumugam karthikraja-arumugam marked this pull request as draft October 7, 2025 14:18
@sheiksyedm sheiksyedm added the area-controls-collectionview CollectionView, CarouselView, IndicatorView label Oct 7, 2025
@karthikraja-arumugam karthikraja-arumugam marked this pull request as ready for review October 7, 2025 14:24
@PureWeen PureWeen added this to the .NET 10 SR1 milestone Oct 8, 2025
@PureWeen PureWeen moved this from Todo to Ready To Review in MAUI SDK Ongoing Oct 8, 2025
@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).


[Test]
[Category(UITestCategories.CollectionView)]
public void EnsureCollectionViewLayoutOnItemsSourceChange()
Copy link
Contributor

Choose a reason for hiding this comment

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

Could expand the tests by setting different item sources and asserting layout change (e.g., when items are added/removed, does the height still reflect correctly?). This ensures future changes do not regress measurement logic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jsuarezruiz, New test scenarios were included. Could you please review and let me know if any concerns?

@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen PureWeen modified the milestones: .NET 10 SR1, .NET 10.0 GA Oct 17, 2025
@PureWeen
Copy link
Member

/backport to release/10.0.1xx

@github-actions
Copy link
Contributor

Started backporting to release/10.0.1xx: https://github.com/dotnet/maui/actions/runs/18596704471

@PureWeen PureWeen added the p/0 Work that we can't release without label Oct 17, 2025
@github-project-automation github-project-automation bot moved this from Ready To Review to Approved in MAUI SDK Ongoing Oct 20, 2025
@PureWeen
Copy link
Member

  • failing tests are unrelated

@PureWeen PureWeen merged commit 70a2858 into dotnet:main Oct 21, 2025
125 of 130 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in MAUI SDK Ongoing Oct 21, 2025
kubaflo pushed a commit to kubaflo/maui that referenced this pull request Oct 23, 2025
…eveloper Balance sample (dotnet#31902)

* Fixed CollectionView card height appears larger in Developer Balance sample

* Issue31897 modified test class

* Issue31897 Modified test sample

* Issue31897 the fix comment has been updated

* Modified the test samppe

---------

Co-authored-by: devanathan-vaithiyanathan <[email protected]>
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 p/0 Work that we can't release without partner/syncfusion Issues / PR's with Syncfusion collaboration platform/ios

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[iOS, Catalyst] CollectionView card height appears larger in Developer Balance sample

5 participants