[Android] Fixed CollectionView MeasureFirstItem ItemSizingStrategy Not Applied in Horizontal Layouts#29474
[Android] Fixed CollectionView MeasureFirstItem ItemSizingStrategy Not Applied in Horizontal Layouts#29474NanthiniMahalingam wants to merge 6 commits intodotnet:mainfrom
Conversation
|
Hey there @@NanthiniMahalingam! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
There was a problem hiding this comment.
Pull Request Overview
This pull request fixes an issue on Android where the CollectionView MeasureFirstItem sizing was not applied correctly in horizontal layouts. The changes ensure that the first item's size is preserved and correctly propagated, while also introducing an UpdateAdapter method to handle layout orientation changes.
- Removed an unnecessary assignment that reset the first item's pixel size.
- Updated the ItemsLayout mapping to call UpdateAdapter before updating the layout manager.
- Added test cases to validate the fix on multiple platforms (Android, Windows, iOS, macOS).
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue29192.cs | Added test case for verifying MeasureFirstItem sizing in CollectionView. |
| src/Controls/tests/TestCases.HostApp/Issues/Issue29192.cs | Introduced a sample ContentPage to test the horizontal layout behavior. |
| src/Controls/src/Core/Handlers/Items/StructuredItemsViewHandler.Android.cs | Updated MapItemsLayout to call UpdateAdapter, ensuring correct adapter updates. |
| src/Controls/src/Core/Handlers/Items/Android/ItemContentView.cs | Removed a duplicate assignment resetting _pixelSize to null. |
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Hi @jsuarezruiz , I've addressed the failing test case. Could you please verify it? |
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/rebase |
e85f80e to
e4c4428
Compare
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
e4c4428 to
ba0ed17
Compare
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 29474Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 29474" |
ba0ed17 to
c2529f6
Compare


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!
Issue Details
Root Cause
Description of Changes
Validated the behaviour in the following platforms
Issues Fixed
Fixes #29192
Output images
Android
Issue29192_Before.mov