Skip to content

Conversation

@Shalini-Ashokan
Copy link
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!

Issue Details

In CarouselView, the ItemsLayout property cannot be changed dynamically at runtime.

Root Cause

The mapper for the items layout was not implemented to support dynamic updates at runtime. As a result, changes made to the layout during runtime had no effect.

Description of Change

Implemented a mapper for the ItemsLayout to enable dynamic updates at runtime.

Validated the behavior in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Issues Fixed

Fixes #29372

Output ScreenShot

Before After
Issue29372BeforeFix.mov
Issue29372AfterFix.mov

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label May 12, 2025
@dotnet-policy-service
Copy link
Contributor

Hey there @@Shalini-Ashokan! 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 May 12, 2025
@jsuarezruiz jsuarezruiz added the area-controls-collectionview CollectionView, CarouselView, IndicatorView label May 12, 2025
@Shalini-Ashokan Shalini-Ashokan marked this pull request as ready for review May 12, 2025 13:29
Copilot AI review requested due to automatic review settings May 12, 2025 13:29
@Shalini-Ashokan Shalini-Ashokan requested a review from a team as a code owner May 12, 2025 13:29
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 PR addresses an issue where the CarouselView's ItemsLayout property did not update dynamically at runtime. The changes implement a mapper for the ItemsLayout property on iOS and Android and add corresponding UI tests to validate the behavior.

  • Added dynamic ItemsLayout mapping and update logic for iOS and Android handlers.
  • Updated test cases in Shared.Tests and HostApp to verify runtime layout changes.
  • Extended conditional compilation in CarouselViewHandler for platform-specific ItemsLayout handling.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue29372.cs Added a UI test for verifying CarouselView ItemsLayout updates (conditional on Windows)
src/Controls/tests/TestCases.HostApp/Issues/Issue29372.cs Created a HostApp page to test dynamic ItemsLayout changes in CarouselView
src/Controls/src/Core/Handlers/Items2/CarouselViewHandler2.iOS.cs Updated the iOS mapper to trigger layout updates when ItemsLayout changes
src/Controls/src/Core/Handlers/Items/CarouselViewHandler.cs Expanded the ItemsLayout mapping condition to include ANDROID
src/Controls/src/Core/Handlers/Items/CarouselViewHandler.Android.cs Added an internal method to update the layout manager when ItemsLayout changes
Comments suppressed due to low confidence (2)

src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue29372.cs:1

  • Consider documenting the rationale behind conditionally excluding Windows from this test scenario to ensure adequate test coverage on all intended platforms.
#if TEST_FAILS_ON_WINDOWS // Related issue for windows: https://github.com/dotnet/maui/issues/29445

src/Controls/src/Core/Handlers/Items/CarouselViewHandler.Android.cs:61

  • Verify that the UpdateLayoutManager method effectively updates the layout in response to runtime ItemsLayout changes, matching the behavior implemented on iOS.
recyclerView.UpdateLayoutManager();

@rmarinho
Copy link
Member

/azp run

@dotnet dotnet deleted a comment from azure-pipelines bot May 13, 2025
@dotnet dotnet deleted a comment from jsuarezruiz May 13, 2025
@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen PureWeen changed the base branch from main to inflight/current May 13, 2025 14:23
@PureWeen PureWeen merged commit a575ab7 into dotnet:inflight/current May 13, 2025
127 of 129 checks passed
github-actions bot pushed a commit that referenced this pull request May 13, 2025
* Fixed the issue for dynamic changes of ItemsLayout property

* Simplified the fix

* Removed unwanted lines

* Modified the fix

* Added null check

* Added a test case and snapshots

* Modified a test case

* Modified the public api to internal
PureWeen pushed a commit that referenced this pull request May 14, 2025
* Fixed the issue for dynamic changes of ItemsLayout property

* Simplified the fix

* Removed unwanted lines

* Modified the fix

* Added null check

* Added a test case and snapshots

* Modified a test case

* Modified the public api to internal
PureWeen pushed a commit that referenced this pull request May 14, 2025
* Fixed the issue for dynamic changes of ItemsLayout property

* Simplified the fix

* Removed unwanted lines

* Modified the fix

* Added null check

* Added a test case and snapshots

* Modified a test case

* Modified the public api to internal
github-actions bot pushed a commit that referenced this pull request May 15, 2025
* Fixed the issue for dynamic changes of ItemsLayout property

* Simplified the fix

* Removed unwanted lines

* Modified the fix

* Added null check

* Added a test case and snapshots

* Modified a test case

* Modified the public api to internal
PureWeen added a commit that referenced this pull request May 21, 2025
For more information about inflight process check
https://github.com/dotnet/maui/wiki/Inflight-Branch-Process

# .NET MAUI Release Notes

## New Release: May 21, 2025

We're excited to announce a new release of .NET MAUI with several bug
fixes and improvements across various platforms.

### Bug Fixes

#### iOS
- **Map Control**: Fixed crash when navigating to a page containing a
map more than once (#29369)
- **CarouselView**: Fixed bounce-back behavior when Loop=false, ensuring
proper scrolling experience (#29318)
- **UIView**: Fixed NullReferenceException for UIView not being in
UIWindow (#29460)

#### Windows
- **CarouselView**: Fixed HorizontalScrollBarVisibility="Never" not
working properly (#29343)
- **UI Controls**: Fixed the color not being applied to the
Expand/Collapse Chevron icon (#29140)

#### Windows & macOS
- **Modal Navigation**: Fixed issue where Disappearing event was not
triggered when closing a window with a modal page (#29129)

#### Android
- **Modal Pages**: Improved inheritance of StatusBar and NavigationBar
background colors (#28568)
- **Footer Scrolling**: Fixed footer scrolling issues in list controls
(#29381)
- **Modal Pages**: Improved inheritance of StatusBar and NavigationBar
background colors on modal pages (#28568)

#### Cross-Platform
- **CarouselView**: Fixed ItemsLayout runtime updates to ensure proper
layout behavior (#29447)
- **CollectionView**: Fixed various issues in CollectionView
implementation (#29423)

### Testing Improvements
- Added feature matrix UITest cases for CollectionView dynamic changes
(#29424)

### Code Quality
- Fixed code formatting issues across the codebase
- Minor typo corrections (#29379)

### Contributors

This release was made possible by the hard work of our dedicated team
and community contributors. We'd like to extend our gratitude to
everyone who has contributed to this release.

### Installation

This update is available through NuGet and the .NET SDK. Update your
projects to get access to these fixes.

### Known Issues

Please refer to our issue tracker for any known issues and their
workarounds.

---

For more information about .NET MAUI, visit [the official
documentation](https://docs.microsoft.com/dotnet/maui/).
PureWeen pushed a commit that referenced this pull request May 21, 2025
* Fixed the issue for dynamic changes of ItemsLayout property

* Simplified the fix

* Removed unwanted lines

* Modified the fix

* Added null check

* Added a test case and snapshots

* Modified a test case

* Modified the public api to internal
@github-actions github-actions bot locked and limited conversation to collaborators Jun 13, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-collectionview CollectionView, CarouselView, IndicatorView community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CarouselView ItemsLayout Not Updating at Runtime

4 participants