-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[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
[iOS] - Resolved Proper Rendering of Dynamic Header/Footer Updates in CV2 #28641
Conversation
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run |
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Please retarget the inflight branch |
I have retargeted to the inflight branch. |
c3d7dd2
to
5b2afee
Compare
… CV2 (dotnet#28641) * Fixed-Header-Footer-Issues-In-CV2 * Modified-Test * Android-Specific Test Restriction * Modified-fix * Added-Comment
… CV2 (#28641) * Fixed-Header-Footer-Issues-In-CV2 * Modified-Test * Android-Specific Test Restriction * Modified-fix * Added-Comment
… CV2 (#28641) * Fixed-Header-Footer-Issues-In-CV2 * Modified-Test * Android-Specific Test Restriction * Modified-fix * Added-Comment
… CV2 (dotnet#28641) * Fixed-Header-Footer-Issues-In-CV2 * Modified-Test * Android-Specific Test Restriction * Modified-fix * Added-Comment
… CV2 (dotnet#28641) * Fixed-Header-Footer-Issues-In-CV2 * Modified-Test * Android-Specific Test Restriction * Modified-fix * Added-Comment
… CV2 (#28641) * Fixed-Header-Footer-Issues-In-CV2 * Modified-Test * Android-Specific Test Restriction * Modified-fix * Added-Comment
### 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
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:
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
Issues Fixed
Fixes #28509
Fixes #28504
Output
CV2BeforeFix.mov
CV2AfterFix.mov