Skip to content

[iOS] - Resolved Proper Rendering of Dynamic Header/Footer Updates in CV2 #28641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 11, 2025

Conversation

prakashKannanSf3972
Copy link
Contributor

@prakashKannanSf3972 prakashKannanSf3972 commented Mar 26, 2025

Issue Details:

  • When the Group Header/Footer Template is not initially set and is later assigned at runtime, the CollectionView does not properly update to reflect the new Group Header/Footer content.

  • When the Header or Footer of a CollectionView is initially set and later updated dynamically with a new DataTemplate or object, the UI does not correctly reflect the updated value.

Root Cause:

The PlatformHandler retains the handler for the initial Header/Footer view even after it is dynamically replaced. As a result:

  • The old view remains in the UI hierarchy.
  • The new view is not properly added to the ItemsView.

Description of Change

  • Mapped GroupHeaderTemplate and GroupFooterTemplate in the handler to trigger a layout update, ensuring the CollectionView dynamically reflects template changes.

  • This update enhances the handling of dynamic CollectionView header and footer updates by ensuring proper cleanup of previous view references. When the header or footer content is changed, the previous handler is nullified, the old view is removed from the UI hierarchy, and binding contexts are cleared. These improvements ensure that the new content is rendered correctly without retaining outdated references.

Tested the behaviour in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Issues Fixed

Fixes #28509
Fixes #28504

Output

Before After
CV2BeforeFix.mov
CV2AfterFix.mov

@dotnet-policy-service dotnet-policy-service bot added community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration labels Mar 26, 2025
@sheiksyedm sheiksyedm added the area-controls-collectionview CollectionView, CarouselView, IndicatorView label Mar 26, 2025
@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@@ -40,6 +40,7 @@ public event EventHandler<LayoutAttributesChangedEventArgs2> LayoutAttributesCha
Size _cachedConstraints;

internal bool MeasureInvalidated => _measureInvalidated;
internal bool isHeaderOrFooterChanged = false;
Copy link
Member

Choose a reason for hiding this comment

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

Why is this added? What do we use it for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rmarinho,

Since both the header and footer are handled as cell types along with regular ItemTemplate cells, the binding logic is shared for both item cells and header/footer cells within the same function. However, when only the header or footer values change, there is no need to recycle the content of templated item cells by cleaning up old views and creating new ones.

The introduced flag helps identify such scenarios and ensures that effectively avoiding redundant validation and view recycling for templated item cells and preventing any negative impact on performance, specifically during header or footer updates.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can include a small comment in the code explaining that's used to avoiding redundant validation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @jsuarezruiz, Added a comment to clarify its role in avoiding unnecessary validation when only the header/footer changes.

@rmarinho
Copy link
Member

Please retarget the inflight branch

@prakashKannanSf3972 prakashKannanSf3972 marked this pull request as ready for review April 2, 2025 07:38
@prakashKannanSf3972 prakashKannanSf3972 requested a review from a team as a code owner April 2, 2025 07:38
@prakashKannanSf3972 prakashKannanSf3972 changed the base branch from main to inflight/current April 2, 2025 07:39
@prakashKannanSf3972
Copy link
Contributor Author

Please retarget the inflight branch

I have retargeted to the inflight branch.

@github-actions github-actions bot force-pushed the inflight/current branch 2 times, most recently from c3d7dd2 to 5b2afee Compare April 3, 2025 15:03
@rmarinho rmarinho merged commit 717a197 into dotnet:inflight/current Apr 11, 2025
2 checks passed
bhavanesh2001 pushed a commit to bhavanesh2001/maui that referenced this pull request Apr 11, 2025
… CV2 (dotnet#28641)

* Fixed-Header-Footer-Issues-In-CV2

* Modified-Test

* Android-Specific Test Restriction

* Modified-fix

* Added-Comment
PureWeen pushed a commit that referenced this pull request Apr 11, 2025
… CV2 (#28641)

* Fixed-Header-Footer-Issues-In-CV2

* Modified-Test

* Android-Specific Test Restriction

* Modified-fix

* Added-Comment
PureWeen pushed a commit that referenced this pull request Apr 16, 2025
… CV2 (#28641)

* Fixed-Header-Footer-Issues-In-CV2

* Modified-Test

* Android-Specific Test Restriction

* Modified-fix

* Added-Comment
sheiksyedm pushed a commit to sheiksyedm/maui that referenced this pull request Apr 17, 2025
… CV2 (dotnet#28641)

* Fixed-Header-Footer-Issues-In-CV2

* Modified-Test

* Android-Specific Test Restriction

* Modified-fix

* Added-Comment
NanthiniMahalingam pushed a commit to NanthiniMahalingam/maui that referenced this pull request Apr 17, 2025
… CV2 (dotnet#28641)

* Fixed-Header-Footer-Issues-In-CV2

* Modified-Test

* Android-Specific Test Restriction

* Modified-fix

* Added-Comment
github-actions bot pushed a commit that referenced this pull request Apr 18, 2025
… CV2 (#28641)

* Fixed-Header-Footer-Issues-In-CV2

* Modified-Test

* Android-Specific Test Restriction

* Modified-fix

* Added-Comment
PureWeen added a commit that referenced this pull request Apr 23, 2025
### Description of Change

## .NET MAUI Release Notes - Inflight/Candidate

## What's Changed

### MAUI Product Fixes
* Fix CarouselView layout SR6 regressions by @albyrock87 in
#29035
* Revert "[Android] picker - focus/unfocus events (#28122)" by @PureWeen
in https://github.com/dotnet/maui/pull/1fb5164929
* [Windows] Fixed the flyout content width not being set correctly after
updating to WinUI SDK 1.7 by @Tamilarasan-Paranthaman in
#28996
* [Android] picker - focus/unfocus events by @kubaflo in
#28122
* [XC] add IRootObjectProvider by @StephaneDelcroix in
#28310
* [iOS] Fix for the File.ContentType from MediaPicker not being in valid
MIME format by @SyedAbdulAzeemSF4852 in
#28842
* [Android] Fixed the Incorrect Text Color Applied to Selected Tab in
TabbedPage by @Ahamed-Ali in #28844
* [iOS] Fix FlyoutPage does not respond to changes in the
FlyoutLayoutBehavior property by @devanathan-vaithiyanathan in
#28884
* [Android] Fixed ScalingCanvas.SetBlur not working by
@NirmalKumarYuvaraj in #28911
* [iOS] - Resolved Proper Rendering of Dynamic Header/Footer Updates in
CV2 by @prakashKannanSf3972 in #28641
* [iOS] Fixed the TargetInvocationException Occurs When Selecting
Header/Footer After Changing ItemsLayout in CV2 by @Ahamed-Ali in
#28890
* [Windows] - Fix Visual State Issue with Picker TextColor After
Navigation by @prakashKannanSf3972 in
#28746

### Dependency Updates
* [Windows] Upgrade to Windows App SDK 1.7 by @MartyIX in
#28499

### Testing
* [Testing] Feature Matrix UITest Cases for CollectionView EmptyView
Feature by @NafeelaNazhir in #28679
* Fixed Test case failure in PR 29037 - [2025/04/21] Candidate by
@HarishKumarSF4517 in #29049

**Full Changelog**:
main...inflight/candidate


For more information about inflight process check
https://github.com/dotnet/maui/wiki/Inflight-Branch-Process
@github-actions github-actions bot locked and limited conversation to collaborators May 12, 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 platform/ios
Projects
None yet
4 participants