-
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
[windows] Fixed CarouselView items rendering #16842
Conversation
src/Controls/src/Core/Platform/Windows/CollectionView/ItemContentControl.cs
Outdated
Show resolved
Hide resolved
63c4ff3
to
d39c47e
Compare
@jknaudt21 I fixed the resizing issue, you can see it in the latest commit |
@mauroa I think there are still a couple of rough edges with the resize changes you pushed. Grey blocks appear when resizing and it doesn't re-center 100% of the timeI might also be nit-picking but it seems that maybe there's a lot of computation going on? The resize felt a bit less responsive. Sometimes resizing the screen very fast causes the app to crash with an NRE.This seems to be easier to repro by resizing as soon as the page loads, so it might be that something isn't fully yet initialized? The failure happens in native UWP code, so it's going to be hard to debug 😅. The stack traces lead me to WindowsMessageManager.uwp.cs. |
d39c47e
to
0fc21ac
Compare
I think we should track this grey item thing when resizing, as a separate issue to investigate. I can reproduce it before my changes and it probably affects other controls as well, it looks like a refreshing issue. Given this PR fixes three bugs and the refreshing issue is pre-existing, I would say we are safe to go and open a separate issue to track the remaining one. |
0fc21ac
to
bd9e5b7
Compare
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.
Approving so the fix can go in and then later polish the issue with resizing the screen.
…in ItemContentControl to not call base when the ItemHeight and ItemWidth are defined When the height and width of the items are already defined, it's likely that the base.MeasureOverride (WinUI) call reduces the original size, causing issues like the items in a CarouselView not fitting the container, which causes more items to be displayed at once. This fix makes sure that we always return the max height and width between the measured override and the existing items height and width. Also, adding ArrangeOverride from WinUI base class to control the layout correctly and completely on our side. Fixes Bug: #12567
bd9e5b7
to
9240aa0
Compare
/backport to net7.0 |
Started backporting to net7.0: https://github.com/dotnet/maui/actions/runs/6017941843 |
@hartez backporting to net7.0 failed, the patch most likely resulted in conflicts: $ git am --3way --ignore-whitespace --keep-non-patch changes.patch
Applying: [windows] Added ArrangeOverride override and changed MeasureOverride in ItemContentControl to not call base when the ItemHeight and ItemWidth are defined
Applying: Added Appium test for CarouselView to validate fix for bug #12567
Applying: Fix RS0016 + added inheritdoc
error: sha1 information is lacking or useless (src/Controls/src/Core/Platform/Windows/CollectionView/ItemContentControl.cs).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0003 Fix RS0016 + added inheritdoc
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128 Please backport manually! |
@hartez an error occurred while backporting to net7.0, please check the run log for details! Error: git am failed, most likely due to a merge conflict. |
Description of Change
Added ArrangeOverride override and changed MeasureOverride in ItemContentControl to not call the base implementation when the ItemHeight and ItemWidth are already defined.
When the height and width of the items are already defined, it's likely that the base.MeasureOverride (WinUI) call reduces the original size, causing issues like the items in a CarouselView not fitting the container, which causes more items to be displayed at once. This fix makes sure that we always return the max height and width between the measured override and the existing items height and width. Also, adding ArrangeOverride from WinUI base class to control the layout correctly and completely on our side.
CarouselView before the fix:
CarouselView after the fix:
Also added Apium tests to validate that a single item is always shown in the carousel.