Sharpnado.CollectionView icon indicating copy to clipboard operation
Sharpnado.CollectionView copied to clipboard

[Xamarin.Forms] CollectionView doesnt scroll to item completly in carousel layout

Open meierhoeferjannis opened this issue 2 years ago • 4 comments

Platform (please complete the following information):

  • OS: Android
  • Device: AndroidEmulator
  • Sdk vervion: Android Sdk 30
  • Xamarin.Forms: [5.0.0.2515]

Describe the bug CollectionView doesnt scroll to an item completly in carousel layout, instead two items are half visible as you can see in the screenshot. It seems like the SnapStyle Center causes this issue.

To Reproduce I created a view and viewmodel, where in the viewmodel the currentindex of the CollectionView is set. When the view appears it seems like the collection view doesnt scroll but because of the snap style center the correct item is not entirely displayed. Instead the collection view is kind a stucked between two items.

I tried the same with a collectionview with horizontal layout and snap style start, and the scrolling just worked perfectly. So i assume the problem is the snap style center, which is mandatory for carousel layout at the moment.

Screenshots (if applicable)

image

meierhoeferjannis avatar Aug 05 '22 17:08 meierhoeferjannis

I discovered that this behaviour is kind of inteded, because in the CollectionViewRenderer in the ScrollToCurrentItem Method there is a offset calculated when the Snap Style is Center. Would it be possible to create a seperate SnapStyle which works like the SnapStyle Center but when it comes to scrolling no offset is calculated. Or a property in the CollectionView to disable offset calculation in the scrollToCurrentItem Method?

meierhoeferjannis avatar Aug 05 '22 18:08 meierhoeferjannis

If you say one of my given solutions would by fine to you, i can make the changes and provide a pr :)

meierhoeferjannis avatar Aug 07 '22 17:08 meierhoeferjannis

Hi just wanted to check if there are any news on this issue :)

meierhoeferjannis avatar Sep 05 '22 12:09 meierhoeferjannis

should be fixed in next version

roubachof avatar Dec 06 '22 10:12 roubachof