dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.24k stars 1.76k forks source link

Inserting Item at index 0 in a collection view with ItemsUpdatingScrollMode="KeepScrollOffset", results in weird animation. #20806

Open MohamedSherifm opened 8 months ago

MohamedSherifm commented 8 months ago

Description

Inserting Item at index 0 in a collection view with ItemsUpdatingScrollMode="KeepScrollOffset", results in weird animation.

Steps to Reproduce

  1. Create New .Net Maui App.
  2. Add Collection View To MainPage.
  3. Set the ItemsUpdatingScrollMode="KeepScrollOffset".
  4. Add Button and bind to a command that Inserts a new item to the collectionview at index 0.

Link to public reproduction project repository

https://github.com/MohamedSherifm/CollectionViewShadowsTest

Version with bug

8.0.7 SR2

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

No

Relevant log output

No response

ghost commented 8 months ago

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

XamlTest commented 7 months ago

Verified this on VS 17.10.0 Preview 2.0(8.0.14). Repro on Android 14.0-API34, not repro on Windows 11, iOS 17.2 and MacCatalyst with below Project: CollectionViewTest.zip Android: AddItem

CodingOctocat commented 4 months ago

I have a similar problem, I'm using a CollectionView with a horizontal layout and every time I insert a new item at index 0, I want to fix the scrollbar so that the new item is always visible(Keep it on the far left.), but the ItemsUpdatingScrollMode doesn't work (I've tried all the enum values), The scrollbar always automatically scrolls to the far right.

Also, I tried to add items using the ObservableCollection.Add method with ItemsUpdatingScrollMode = "KeepLastItemInView" and it does work, but I don't see the animation (maybe the animation isn't obvious???).