Skip to content
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 [iOS]VerticalOffset Not Reset to Zero After Clearing ItemSource in CollectionView #26818

Conversation

devanathan-vaithiyanathan
Copy link
Contributor

@devanathan-vaithiyanathan devanathan-vaithiyanathan commented Dec 26, 2024

Issue Details:

When clearing the ItemSource of a CollectionView, the VerticalOffset does not reset to zero on iOS and MacCatalyst. Instead, the last offset value is retained. However, after adding items back to the ItemSource, the VerticalOffset updates as expected when scrolling.

Root Cause:

The UIScrollView.ContentOffset retains its previous value even when the ItemSource is cleared, as there are no visible items in the CollectionView. The VerticalOffset property of the CollectionView depends on the ContentOffset value, which is not reset in such cases.

Description of Change

Reset HorizontalOffset and VerticalOffset to zero when ItemSource is empty and no items are visible.

Issues Fixed

Fixes #26798

Regarding Test case

The test case for this fix is included in this PR

Validated the behaviour in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Output Screenshot

Before After
BeforeFix.mov
AfterFix.mov

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Dec 26, 2024
Copy link
Contributor

Hey there @devanathan-vaithiyanathan! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@karthikraja-arumugam karthikraja-arumugam added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Dec 26, 2024
@PureWeen PureWeen added the area-controls-collectionview CollectionView, CarouselView, IndicatorView label Dec 26, 2024
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[iOS]VerticalOffset Not Reset to Zero After Clearing ItemSource in CollectionView
3 participants