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

CollectionView.Scrolled event offset isn't correctly reset when items change on Android #21708

Open
nshtinkov opened this issue Apr 8, 2024 · 2 comments · May be fixed by #26782
Open

CollectionView.Scrolled event offset isn't correctly reset when items change on Android #21708

nshtinkov opened this issue Apr 8, 2024 · 2 comments · May be fixed by #26782
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert partner/syncfusion Issues / PR's with Syncfusion collaboration platform/android 🤖 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@nshtinkov
Copy link

Description

When changing the contents of the CollectionView.ItemsSource while scrolled down into the list, ItemsViewScrolledEventArgs.VerticalOffset is not correctly updated in Android.

Offset "0" should be at the start of the collection; instead the start offsets changes as items are added/removed. It manifests only when the collection is scrolled to after the position of the added/deleted items.

This issue was known and fixed in Xamarin.Forms: xamarin/Xamarin.Forms#7993 . It has reappeared in MAUI.

The repro app is adapted from the Xamarin issue.

Steps to Reproduce

  1. Start repro app on Android (device or simulator).
  2. Use "Fill" button to populate the list
  3. Scroll down the list
  4. Use "Empty" button to clear the list.
  5. Use "Fill" button again.
  6. Scroll down and up the list; the start offset is not 0 as it should be.
    image

Link to public reproduction project repository

https://github.com/nshtinkov/MauiScrollOffsetAndroidBug

Version with bug

8.0.7 SR2

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 13

Did you find any workaround?

Replacing the ItemsSource collection after change seems to work, e.g. in the repro app:

		private void EmptyButton_OnClicked(object sender, EventArgs e)
		{
			_items.Clear();
			Items = new ReadOnlyObservableCollection<int>(_items);
		}

Relevant log output

No response

@nshtinkov nshtinkov added the t/bug Something isn't working label Apr 8, 2024
@Zhanglirong-Winnie Zhanglirong-Winnie added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed potential-regression This issue described a possible regression on a currently supported version., verification pending labels Apr 9, 2024
@Zhanglirong-Winnie
Copy link

Verified this issue with Visual Studio 17.10.0 Preview 2(8.0.7 & 8.0.14 & 8.0.0-rc.2.9530). Can repro on android platform with sample project.

@PureWeen PureWeen added migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert and removed potential-regression This issue described a possible regression on a currently supported version., verification pending labels Apr 9, 2024
@Eilon Eilon added the area-controls-collectionview CollectionView, CarouselView, IndicatorView label Apr 30, 2024
@jsuarezruiz jsuarezruiz added this to the Backlog milestone Jun 4, 2024
@samhouts samhouts removed s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Jul 3, 2024
@samhouts samhouts added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Jul 10, 2024
@nshtinkov
Copy link
Author

The bug is still there in 8.0.90.

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 migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert partner/syncfusion Issues / PR's with Syncfusion collaboration platform/android 🤖 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
7 participants