Migrated from https://bugzilla.xamarin.com/show_bug.cgi?id=60720
The ItemTapped event for a grouped ListView is not working as expected.
ItemTappedEventArgs.Group is populated as expected, however ItemTappedEventArgs.Item is null sometimes, and not the item expected for all items further down the list.
In the sample i got two lists inside a GroupList, in the first list I get a Null in the ItemTappedEventArgs.item when I click the first element of that list, on my second list I get that behaviour (get a Null in the ItemTappedEventArgs) when I clicked the second element of that second list…
I’m sending a complete solution (in attach) where this is replicable.
Possible duplication of this issue #1401
I confirm I have the same issue as well.
For onItemSelected event, once the items are grouped my first item is null.
when the rest of the items are clicked, the onItemSelected has e.SelectedItem as the item before the one I actually selected.
I have this issue on UWP
@davidortinau @pauldipietro Bugfix proposal attached So, after hours of trying to debug Xamarin.Forms from my project, I decided to debug directly, with existing test cases (like G1763). I tried my fix also with multiple groups and without any groups.
UWP-Fix-click-and-tap-returns-incorrect-ListItem-1439.patch.txt
Explanation:
The problem seems to be with the ...UAP/ListViewRender.cs void OnListItemClicked(object sender, ItemClickEventArgs e)
it passes the index based on the Items and not based on the global-index. This value gets sent to the Xamarin core's ListView.cs NotifyRowTapped
and again to TemplatedItems.GetGroupIndexFromGlobal
. This method expects the index to be a globalIndex. So, I changed the original passed index to be the global-index value using the TemplatedItemsView.TemplatedItems.GetGlobalIndexOfItem(e.ClickedItem)
method.
PS: I'm quite sure this fixes the tap event too, but not 100% sure.
@davidortinau @pauldipietro Is there an update on this huge bug? It prevents me from updating the UWP app and this is a problem. Will the research on this issue from @r-a-y-w help to fix this issue?
Any ETA on when this will be fixed?
I am also struggling with this issue. Any ETA would be useful as I need to get a new release out to the customer this month....
@davidortinau @pauldipietro we have the same issue.. we are going to have to wait to release our UWP app until it is fixed. This seems like a pretty fundamental bug that should be easily fixed.
@rmarinho @samhouts Thank you very much for fixing this issue! Can you tell me when this fix will be released on Nuget/as a new version? I'd like to update my app with this fix as fast as possible!
Thanks @samhouts and @rmarinho :)
@rmarinho @samhouts Same here. When will it be available?
Should be available on the nightly, can you try that ?
@rmarinho we don't want to use the nightly, do you have an eta for actual release
Which nightly version? I just tried the latest 2.5.1 nightly (102606) and it doesn't seem to be fixed. I tried a 2.6.0 nightly as well, but I hit compile issues with not using .NET standard.
Works good on nightly 2.6.0.108998
Yep, works on latest nightly. @alistair23 did you update your legacy PCL projects to .NET 2.0 projects before upgrading the nuget packages?
The latest 2.6 nightly @kingces95? I did see compilation errors mentioning I had to use .NET standard 2.0 when I tried Xamarin.Forms 2.6.
.NET Standard 2.0 doesn't work on older versions of Windows though, so I can't use that. Maybe I can try .NET standard 1.4 and see if that works. I was hoping to be able to use Xamarin.Forms 2.5 though.
@alistair23 Some platforms that do not support .NET Standard 2.0 will no longer be supported with XF2.5. What platform are you trying to use that won't work on .NET Standard 2.0?
I'm trying to run on all Windows 10 versions, including Windows 10 Mobile. At the moment the latest XF2.5 release works, it just has this bug.
For us WinRT and UWP is important. I hope at least that if it won’t work, a cherry-pick and an older release will be made for just this bug.
The fix is in master, which isn't that far ahead of the latest tagged 2.5 release (release-2.5.0-sr3). It doesn't seem that hard to cut another 2.5 release with the fix. I can't figure out what the 2.5.1 or 2.6 nighties are being built from though, so it's hard to say.
PS: I’ve seen commits removing older Windows support but no official response nor any deprecation/breaking change info on any roadmap/release notes, so I assumed those breaking changes wouldn’t be merged into the release branch yet.
Ah, that is tougher. I see the commit removing Windows 8.1 support in the 2.4 and 2.5 releases.
That sucks! Was it ever mentioned anywhere that it’d break? The latest 2.5 release seemed to work fine except for this bug, which is why we couldn’t make a new release and why I spent time helping to get it fixed. I’m sure they can make an old 2.5.0.1 release with a cherry-pick, or not? It sort of makes the effort of the last realeases for anyone using a grouped list on Windows pointless. I hope in the end I won’t have to downgrade to 2.3.7 again :D
The roadmap has reflected the Win 8.1, 8.0 removal for nearly 6 months if memory serves. Current version https://github.com/xamarin/Xamarin.Forms/wiki/Feature-Roadmap
Official support ended July 2017 for most of that. You can find it on different Microsoft sites.
Our vNext (master) release is yet a ways off, and we will be shipping additional bug fix releases on the vCurrent release branch. So it seems reasonable to consider back porting this fix. Will discuss with the team.
Is the vCurrent branch visible? I'd be happy to help with the back porting effort.
@samhouts (or @davidortinau) So, I'm a bit confused, what is missing for the current NuGet release to get this bugfix? You said it is already in the 8.1 branch? I'm using 2.5.0.122203 and this bug still exists. Is it possible to make a 2.5.0.xxx release with this fix so we can finally make a release for 8.1 & UWP?
@davidortinau Thanks for the Wiki.
@alistair23 It's apparently already in the branch: https://github.com/xamarin/Xamarin.Forms/pull/1499#issuecomment-360246566
Ah awesome! So it looks like the 15-5 branch is the 2.5 release branch: https://github.com/xamarin/Xamarin.Forms/commits/15-5
Can nightlies just be turned on for that branch/2.5 release?
...or create a minor release 2.5.0.1.22204, which would take less time than each of us probably spent commenting here about this issue, since the fix 😆
What @r-a-y-w is saying makes perfect sense; why is this not happening?
Edit: Removed to keep out the negativity 😁 as @alistair23 pointed out below, it looks like they're working on it. 😄
They are getting close. There is a new 2.5 tag (https://github.com/xamarin/Xamarin.Forms/releases/tag/release-2.5.0-sr4). There just aren't any builds available via NuGet yet
It .. feels .. so .. close.
The whole reason we chose Xamarin over React Native was UWP support because it was bought by Microsoft. Aaargh!
History seems to show that it takes up to three days from a tag to get a release. We are now overdue for a release, by roughly a day.
Assuming the release means that we can get the package via NuGet. We should be seeing it extremely soon.
10 days old... Hmm, really don't get this release process, unless they want to add more to the release?
Can't this issue get re-opened until it is actually released?
Yeah, I'm a little confused too. You can't change a tag in git (It is technically possible, but it's such a bad idea that no one ever would) so they aren't going to add anything to it. I'm not sure what we are waiting for.
Apparently they just changed the tag.... I don't think I've ever seen that done before. The git documentation literately describes that as "The insane thing".
Now I guess there is no way to know how close we are.
Rebuilding for QA. Expecting to ship as soon as it's approved.
Woo! The release is made. I can see he package here: https://github.com/xamarin/Xamarin.Forms/releases/tag/release-2.5.0-sr4
I manually downloaded it and it fixes the problem for me :)
Woohoo, excited❗️❗️❗️
@alistair23 Saw there's already an sr5 release, minor fix https://github.com/xamarin/Xamarin.Forms/releases/tag/release-2.5.0-sr5
NuGet Release is available now 💯
Thanks all and especially @davidortinau & @samhouts for making this happen!!!
Most helpful comment
@rmarinho we don't want to use the nightly, do you have an eta for actual release