-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Fix CollectionView not displaying header or footers #16870
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Eilon
added
the
area-controls-collectionview
CollectionView, CarouselView, IndicatorView
label
Aug 19, 2023
Paging @jonathanpeppers for memory leaks implications |
PureWeen
previously requested changes
Aug 20, 2023
src/Controls/src/Core/Handlers/Shell/Windows/ViewToHandlerConverter.cs
Outdated
Show resolved
Hide resolved
hartez
previously approved these changes
Aug 22, 2023
hartez
previously approved these changes
Aug 22, 2023
hartez
suggested changes
Aug 22, 2023
src/Controls/src/Core/Handlers/Items/ItemsViewHandler.Windows.cs
Outdated
Show resolved
Hide resolved
hartez
previously approved these changes
Aug 23, 2023
So this seems to be a new bug. The Android collection view leaks if it has a header or footer :( Edit: The failing Android tests and leak have been fixed: #17012 |
src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.cs
Outdated
Show resolved
Hide resolved
src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.cs
Outdated
Show resolved
Hide resolved
jknaudt21
force-pushed
the
dev/jd/collectionviewfoot
branch
from
August 23, 2023 18:16
8975c5e
to
c70a08b
Compare
src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.cs
Outdated
Show resolved
Hide resolved
mattleibow
reviewed
Aug 23, 2023
src/Controls/src/Core/Platform/Windows/CollectionView/ItemContentControl.cs
Outdated
Show resolved
Hide resolved
jknaudt21
force-pushed
the
dev/jd/collectionviewfoot
branch
from
August 28, 2023 18:32
35b3ca3
to
ffe0fa7
Compare
Tentative change
We only cant to remove chlidren that are inside the items.
jknaudt21
force-pushed
the
dev/jd/collectionviewfoot
branch
from
August 28, 2023 23:40
ffe0fa7
to
c1793dc
Compare
jknaudt21
dismissed
PureWeen’s stale review
September 1, 2023 19:22
Requested changes have been made
hartez
approved these changes
Sep 5, 2023
tj-devel709
pushed a commit
to tj-devel709/maui
that referenced
this pull request
Sep 8, 2023
* Make ViewHandlerConverter use apps MauiContext Tentative change * Improve comment * Fix render issue from logical child perspective * Add UI test * Only clear items in the ItemSource We only cant to remove chlidren that are inside the items. * Address PR feedback * Bandaid fix android tests * Add missing link * Simplify code * Fix merge conflicts * Newline nit
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
area-controls-collectionview
CollectionView, CarouselView, IndicatorView
fixed-in-8.0.0-rc.2.9373
Look for this fix in 8.0.0-rc.2.9373!
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The footer and header's of a CollectionView would not display on Windows.
This was happening because they were created as
WrapperControl
in ViewToHandlerConverter.cs , and when being initialized they didn't have parents (although they should!). This, in turn, prevents them from getting the appropriate MauiContext when callingview.FindMauiContext()
. Without the context, they can't render.The reason why they ended up having no parents was because we make a call to
ClearLogicalChildren
when updating an ItemsSource. This was made to prevent memory leaks but had the unintended side effect of not rendering the headers and footers. #13530Solution
We ensure to only clear up the items in the ItemSource of the CollectionView. That way any logical child that should persist is not wiped, and can thereby render correctly.
Before & After
I'm using an empty collection view with a footer and header
Sample code
Issues Fixed
Fixes #14557
Remaining work