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

SwipeView erroneusly triggers SelectionChangedCommand in CollectionView on swiping gesture. (Was not the case with Xamarin.Forms) #22711

Open inimirpaz opened 5 months ago

inimirpaz commented 5 months ago

Description

Hello, I have found a migration issue when using SwipeViews nested in a CollectionView. The SelectionChangedCommand is fired during the swiping operations. This was not the intended behavior with Xamarin.Forms . In fact, the command is executed both on the opening gesture and when the user closes the SwipeView (either by swiping it back or by tapping on the row). The command should not be invoked in none of those scenarios.

Repro provides both the .NET MAUI and the Xamarin.Forms solutions.

Steps to Reproduce

No response

Link to public reproduction project repository

https://github.com/inimirpaz/maui_issues/tree/swipeview_tap_issue

Version with bug

8.0.40 SR5

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

iOS, Android

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

No response

github-actions[bot] commented 5 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

Quaybe commented 5 months ago

That second item looks to be the same issue as yours (I'm having this issue too)

ninachen03 commented 5 months ago

Verified this issue with Visual Studio 17.11.0 Preview 1.0 ( 8.0.40 & 8.0.21& 8.0.3 ) Can repro it, Xamarin.Forms works fine

tbambuch commented 5 months ago

this is (on Android) caused by MauiSwipeView.PropagateParentTouch() function, which fires itemContentView?.CallOnClick every time. Previously, in XF, there used to be a check for ((ISwipeViewController)Element).IsOpen which is missing now for unknown reason