Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Open
wants to merge 18 commits into
base: main
Choose a base branch
Loading
from

Conversation

SuthiYuvaraj
Copy link
Contributor

Issue Details

When Grouping is enabled in the CollectionViewand programmatically scrolling to an item within a group does not align correctly based on the GroupHeader.

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 the GroupHeader 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

  • Android
  • Windows
  • iOS
  • Mac

Output Screenshot

Before Issue Fix After Issue Fix
Before Fix After Fix

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Feb 27, 2025
Copy link
Contributor

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.

@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Feb 27, 2025
@jsuarezruiz jsuarezruiz added platform/windows area-controls-collectionview CollectionView, CarouselView, IndicatorView labels Feb 27, 2025
@@ -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))
Copy link
Contributor

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);

Copy link
Contributor Author

@SuthiYuvaraj SuthiYuvaraj Feb 27, 2025

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;
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@rmarinho
Copy link
Member

/rebase

@jsuarezruiz
Copy link
Contributor

/rebase

@SuthiYuvaraj SuthiYuvaraj marked this pull request as ready for review March 5, 2025 09:30
@SuthiYuvaraj SuthiYuvaraj requested a review from a team as a code owner March 5, 2025 09:30
@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz
Copy link
Contributor

/rebase

@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz
Copy link
Contributor

/rebase

@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz
Copy link
Contributor

/rebase

@jsuarezruiz
Copy link
Contributor

/rebase

@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

Copy link

Azure Pipelines successfully started running 1 pipeline(s).


[Test]
[Category(UITestCategories.CollectionView)]
public void ItemShouldbeScrolledbasedOnGroupHeader()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is failing on iOS.
Snapshot different than baseline: ItemShouldbeScrolledbasedOnGroupHeader.png (2.50% difference)
image

Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

I9_Scroll by object for grouped data - The group name is always pined at the top after clicking 'Scroll to Proboscis Monkey' button
3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.