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

[iOS] ListView ItemSelected fires when selecting group header row #3587

Open davidortinau opened 6 years ago

davidortinau commented 6 years ago

Description

https://www.screencast.com/t/jj1GyFynx

When selecting the group header, the first row in the group is selected. This is not the expected behavior and does not occur on the first group section.

This does not happen on Android.

Steps to Reproduce

  1. Select the group header of the first section and notice the ItemSelected event does not fire.
  2. Select a row and notice it does.
  3. Select the second section group header and notice it fires.

Expected Behavior

Selecting group headers should not fire ItemSelected for the first row in the group

Actual Behavior

ItemSelect fires and first row of group is selected.

Basic Information

Reproduction Link

Archive.zip

tcerdaj commented 6 years ago

Any solution to this issue? Thanks.

rd09 commented 6 years ago

Any workaround for this issue?

tcerdaj commented 6 years ago

Fix it by adding a Tapping event inside the ViewCell.

backend: public void YourEventName_Tapping(object sender, MR.Gesture.TapEventArgs e) { //empty } That's all, test it now.
jfversluis commented 5 years ago

Hm, I have looked into this, something weird is going on. For the second header, it indeed selects the first cell in that group. However, if you have scrolled up and then press the first (sticky) header, the cell behind that is selected as well.

Header tap bug

I was looking for a fix and had one by disabling the user interactions on the header. Though, this only helps for the first scenario, not the tapping "through" the sticky header. Also, this has the implication that a tapped event and/or TapGestureRecognizer that the user puts in there stops working. And at that point, I decided to leave it like this for now 😅

Depechie commented 5 years ago

Still drives me crazy... any news on this? I also tried finding out why it was happening by debugging XF itself. But seems the implementation to do grouped lists is a bit different than what you regularly find for Xamarin.iOS samples. Probably due to some internal XF features for ListView.

Is CollectionView ever going to get grouped items? @davidortinau

aspnetde commented 5 years ago

We ran into this as well ...

jfversluis commented 5 years ago

@Depechie according to the spec it will #3172, not sure on the timeline, but it's coming!