-
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] Fix CollectionView.RemainingItemsThresholdReached #14391
Conversation
* Fixed an issue where the `CollectionView.RemainingItemsThresholdReached` event wasn't firing on Windows. * Added a DeviceTest for the event
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.
Per-se good, I believe that we can achieve the same with a switch expr which would be more elegant, but it is not a reason to block a PR.
case 0: | ||
if (itemsViewScrolledEventArgs.LastVisibleItemIndex == ItemCount - 1) |
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 this two statements be merged in a single switch expression?
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.
Yup yup, actually I think the switch can be completely removed.
default: | ||
if (ItemCount - 1 - itemsViewScrolledEventArgs.LastVisibleItemIndex <= Element.RemainingItemsThreshold) |
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.
Same comment.
@@ -423,6 +423,12 @@ internal void HandleScroll(ScrollViewer scrollViewer) | |||
itemsViewScrolledEventArgs = ComputeVisibleIndexes(itemsViewScrolledEventArgs, layoutOrientaton, advancing); | |||
|
|||
Element.SendScrolled(itemsViewScrolledEventArgs); | |||
|
|||
if (Element.RemainingItemsThreshold > -1 && |
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.
we should grab this value and use so we don't hit the BP twice
src/Controls/src/Core/Handlers/Items/ItemsViewHandler.Windows.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Rui Marinho <me@ruimarinho.net>
* fix(bug): Fix `RemainingItemsThresholdReached` on Windows * Fixed an issue where the `CollectionView.RemainingItemsThresholdReached` event wasn't firing on Windows. * Added a DeviceTest for the event * Remove switch statement * Update src/Controls/src/Core/Handlers/Items/ItemsViewHandler.Windows.cs Co-authored-by: Rui Marinho <me@ruimarinho.net> --------- Co-authored-by: Mike Corsaro <mikecorsaro@microsoft.com> Co-authored-by: Rui Marinho <me@ruimarinho.net>
/backport to net7.0 |
Started backporting to net7.0: https://github.com/dotnet/maui/actions/runs/5138919704 |
@hartez backporting to net7.0 failed, the patch most likely resulted in conflicts: $ git am --3way --ignore-whitespace --keep-non-patch changes.patch
Applying: fix(bug): Fix `RemainingItemsThresholdReached` on Windows
Using index info to reconstruct a base tree...
M src/Controls/src/Core/Handlers/Items/ItemsViewHandler.Windows.cs
M src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.Windows.cs
Falling back to patching base and 3-way merge...
Auto-merging src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.Windows.cs
CONFLICT (content): Merge conflict in src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.Windows.cs
Auto-merging src/Controls/src/Core/Handlers/Items/ItemsViewHandler.Windows.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 fix(bug): Fix `RemainingItemsThresholdReached` on Windows
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. |
* fix(bug): Fix `RemainingItemsThresholdReached` on Windows * Fixed an issue where the `CollectionView.RemainingItemsThresholdReached` event wasn't firing on Windows. * Added a DeviceTest for the event * Remove switch statement * Update src/Controls/src/Core/Handlers/Items/ItemsViewHandler.Windows.cs Co-authored-by: Rui Marinho <me@ruimarinho.net> --------- Co-authored-by: Mike Corsaro <mikecorsaro@microsoft.com> Co-authored-by: Rui Marinho <me@ruimarinho.net>
Description of Change
CollectionView.RemainingItemsThresholdReached
event wasn't firing on Windows. This issue was caused by missing code inItemsViewHandler.Windows
to fire the event.Issues Fixed
Fixes #8338
Fixes #9935 (dupe)
Fixes #12066 (dupe)