Bug 56803 - ListView SelectedItem highlighting doesn't work
Summary: ListView SelectedItem highlighting doesn't work
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.3.4
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
: 58817 ()
Depends on:
Reported: 2017-05-24 13:52 UTC by Andriy Borysov
Modified: 2017-08-16 15:58 UTC (History)
3 users (show)

Tags: listview selecteditem ac
Is this bug a regression?: ---
Last known good build:

Sample to reproduce (50.02 KB, application/x-zip-compressed)
2017-05-24 13:55 UTC, Andriy Borysov

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 56803 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Andriy Borysov 2017-05-24 13:52:14 UTC

Comment 1 Andriy Borysov 2017-05-24 13:55:21 UTC
Created attachment 22423 [details]
Sample to reproduce
Comment 2 Andriy Borysov 2017-05-24 14:03:18 UTC
Sorry, posted without description accidentally.

The problem is similar to https://bugzilla.xamarin.com/show_bug.cgi?id=47712 .

When `ListView.ItemsSource` and `ListView.SelectedItem` are set from a constructor of a view model, there is kind of race condition in highlighting corresponding list item on Android.

In the sample provided, one can tap on a list item, that opens new instance of the same page with same items, and predefined item to set as `ListView.SelectedItem`. As result, corresponding item is not highlighted.

In addition, if one taps quickly on list items, that opens many pages, then several pages does not have any selection.

Neither `ObservableCollection`, nor `Binding.Mode` fixes the problem.
Comment 3 Paul DiPietro [MSFT] 2017-05-30 04:09:49 UTC
Also tested this against the nightly where it occurs. Setting to confirmed until further investigation.
Comment 4 Paul DiPietro [MSFT] 2017-08-16 15:58:09 UTC
*** Bug 58817 has been marked as a duplicate of this bug. ***