-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Fix for Item should scrolled based on the GroupHeaderTemplate #28074
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
base: main
Are you sure you want to change the base?
Conversation
Hey there @SuthiYuvaraj! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
@@ -30,6 +30,29 @@ static UWPPoint AdjustToMakeVisible(UWPPoint point, UWPSize itemSize, ScrollView | ||
return AdjustToMakeVisibleHorizontal(point, itemSize, scrollViewer); | ||
} | ||
|
||
static UWPPoint AdjustToStart(UWPPoint point, ScrollViewer scrollViewer, double height) | ||
{ | ||
if (IsVertical(scrollViewer)) |
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.
return IsVertical(scrollViewer)
? AdjustToStartVertical(point, height)
: AdjustToStartHorizontal(point, height);
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.
@jsuarezruiz ,I have addressed the return statement changes. Let me know if anything else needs adjustment.
static double GetHeaderHeight(ListViewBase list, UIElement targetContainer) | ||
{ | ||
var groupHeader = list.GroupHeaderContainerFromItemContainer(targetContainer); | ||
return (groupHeader as ListViewHeaderItem).ActualHeight; |
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.
Maybe, before this line check:
if (groupHeader is ListViewHeaderItem headerItem)
in that case return the ActualHeight, and in other 0.
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.
I have modified the condition based on your suggestion. Let me know if anyother concern.
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27922.cs
Outdated
Show resolved
Hide resolved
/rebase |
fba0d78
to
348d136
Compare
/rebase |
348d136
to
fae6bf2
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/rebase |
f0d165c
to
e90e551
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/rebase |
6709859
to
eff6e00
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/rebase |
eff6e00
to
6d97afa
Compare
/rebase |
6d97afa
to
b28e2dd
Compare
/azp run MAUI-UITests-public |
Azure Pipelines successfully started running 1 pipeline(s). |
|
||
[Test] | ||
[Category(UITestCategories.CollectionView)] | ||
public void ItemShouldbeScrolledbasedOnGroupHeader() |
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.
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.
Hi @jsuarezruiz , I have analyzed the test case failure and made the necessary modifications. Please review the updated test case and let me know if you have any concerns.
Issue Details
When
Grouping
is enabled in theCollectionView
and programmatically scrolling to an item within a group does not align correctly based on theGroupHeader
.On Windows, the GroupHeader functions as a sticky header, meaning it remains at the top of the group. As a result, when scrolling, the target item may be hidden beneath the header. On other platforms, where the GroupHeader is not sticky, scrolling works as expected.
Root Cause
When scrolling with animation, the position is determined based on the calculated offset. The
AnimateToItemAsync
method does not account for any initial offset. Since theGroupHeader
remains sticky on Windows, the target item may get hidden behind it during scrolling.Description of Change
Introduced an
AdjustToStart
method to ensure that the header is properly positioned at the top.Added a
GetHeaderHeight
method to check whether the list contains a header. If a header is present, it calculates the height of the GroupHeaderContainer for the target item.Issues Fixed
Fixes #27922
Tested the behaviour in the following platforms
Output Screenshot