This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 44886 - UWP Listview ItemSelected event triggered twice for each selection
Summary: UWP Listview ItemSelected event triggered twice for each selection
Status: IN_PROGRESS
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows (show other bugs)
Version: 2.3.2
Hardware: PC Windows
: Highest critical
Target Milestone: ---
Assignee: Samantha Houts
URL:
: 45219 47602 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-09-29 14:11 UTC by Taylor
Modified: 2017-06-22 18:20 UTC (History)
10 users (show)

See Also:
Tags: ac, UWP, ListView fr
Is this bug a regression?: Yes
Last known good build: 2.3.4.247


Attachments
Reproduction Project (246.70 KB, application/x-zip-compressed)
2016-09-29 14:16 UTC, Taylor
Details

Description Taylor 2016-09-29 14:11:43 UTC
The ItemSelected event is being triggered twice each time an item is selected on a listview.  This issue is only occuring on UWP with the latest version of Forms(2.3.2.127).

I have attached an example reproduction case.  When the app launched you will be presented with a very basic listview with 5 items.  Selecting one of those items will cause a dialog to appear telling you which item you selected.  Additionally, when run in debug mode the item you selected will be printed to the console.

When running on Android or iOS this dialog is only displayed once, and the selected item is printed to the console once.  On UWP this happens twice.
Comment 1 Taylor 2016-09-29 14:16:28 UTC
Created attachment 17803 [details]
Reproduction Project
Comment 2 Samantha Houts 2016-09-30 23:03:32 UTC
Should be fixed in 2.3.4-pre1. Thank you!
Comment 3 Samantha Houts 2016-10-14 18:52:36 UTC
*** Bug 45219 has been marked as a duplicate of this bug. ***
Comment 4 Parmendra Kumar 2016-11-03 12:05:55 UTC
I have checked this issue and observed that this issue has been fixed with Xamarin.Forms 2.3.3-pre3.

Hence closing this issue.
Comment 5 Christer van der Meeren 2017-04-21 10:50:05 UTC
It seems this has resurfaced in 2.3.5-pre1. Not the first time an item is selected, but from the 2nd time, it's triggered twice.
Comment 6 Matthias H 2017-04-26 15:19:28 UTC
I can confirm that this is still an issue in 2.3.5-pre1. When using the ItemSelected event to display a new page, the back button has to be pressed twice because the event is triggered twice. The status of this bug should be changed, since it has not been fixed.
Comment 7 Dániel Buga 2017-04-27 07:24:35 UTC
This is still present, the property is set from here:

Xamarin.Forms.Platform.UAP.dll!Xamarin.Forms.Platform.UWP.ListViewRenderer.OnControlSelectionChanged(object sender, Windows.UI.Xaml.Controls.SelectionChangedEventArgs e)

and after that is is also set by Xamarin.Forms.Platform.UAP.dll!Xamarin.Forms.Platform.UWP.ListViewRenderer.ListOnTapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs args)
Comment 8 Adam Patridge 2017-06-16 15:12:56 UTC
I spun up a new Forms project and copied in the App.cs from the attached repro ZIP. I then upgraded to the latest stable and threw a breakpoint in the ListView_ItemSelected method.

I do not see this issue in Xamarin.Forms v2.3.4.247 (combined with the UWP NuGet of v5.3.3, if that matters).

Unfortunately, When I then updated to the latest pre-release, v2.3.5.239-pre3, the breakpoint is hit twice.
Comment 9 Samantha Houts 2017-06-19 18:56:52 UTC
*** Bug 47602 has been marked as a duplicate of this bug. ***
Comment 10 Samantha Houts 2017-06-21 19:58:09 UTC
https://github.com/xamarin/Xamarin.Forms/pull/1005

Note You need to log in before you can comment on or make changes to this bug.