xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.62k stars 1.87k forks source link

[Bug] CarouselView reverting updated CurrentPosition on UWP. #15536

Open Bloodyairtimer opened 2 years ago

Bloodyairtimer commented 2 years ago

Description

The issue occurs when I use the Position property on the CarouselView to update the carousel to go to the next item. On UWP the Position is updated via the viewmodel property and the PositionChanged event is fired with the correct position parameter. Right after that the PositionChanged event is fired directly again, this time reverting the previous change.

The callstack is showing the first update that it is triggered by the update from the CurrentPosition property on the viewmodel. The second time there is no callstack other than the event.

Tried to change the binding to oneway. No difference. Sometimes when fast clicking the button on the screen multiple times the screen is navigating to the next view.

Steps to Reproduce

  1. Start the app
  2. Click the next button
  3. See the output window where debug logging is added to show the behavior.

Expected Behavior

When updating the position property on the viewmodel the control should react and navigate to the next page.

Actual Behavior

The screen is bouncing a bit and reverting the position change.

Basic Information

Environment

Reproduction Link

App6.zip

iancona commented 2 years ago

Same issue, not happening on Android with same code. I've also disabled swipegesture on UWP because the scrolling was a mess

iancona commented 2 years ago

Tried making CarouselView.IsScrollAnimated false as workaround and it seems to work

Bloodyairtimer commented 2 years ago

That seems to work indeed.