roubachof / Sharpnado.CollectionView

A performant list view supporting: grid, horizontal and vertical layout, drag and drop, and reveal animations.
The Unlicense
245 stars 30 forks source link

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

Open meierhoeferjannis opened 2 years ago

meierhoeferjannis commented 2 years ago

Platform (please complete the following information):

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 commented 2 years ago

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 commented 2 years ago

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

meierhoeferjannis commented 2 years ago

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

roubachof commented 1 year ago

should be fixed in next version