Bug 38851 - [Forms] Unexpected Listview deselection behavior (XAML)
Summary: [Forms] Unexpected Listview deselection behavior (XAML)
Status: CONFIRMED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.0.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-02-17 16:00 UTC by Matthew Regul
Modified: 2016-02-17 18:40 UTC (History)
8 users (show)

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

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 38851 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:
Status:
CONFIRMED

Description Matthew Regul 2016-02-17 16:00:44 UTC
== Overview: =================================
Calling `List.SelectedItem = null` does not always clear the selected list item, multiple calls/clicks may be required.

Possible that this is a result of having the 'clear' nested inside of an If Statement?
(as seen here - https://gist.github.com/mattregul/c1356a808a20b1a2c734#file-testpage-xaml-cs-L56-L72)

When calling `List.SelectedItem = null` unnested, at the end of OnItemSelected(), the list item will clear as expected.
(as seen here - https://gist.github.com/mattregul/c1356a808a20b1a2c734#file-testpage-xaml-cs-L91-L108)


== Steps to Reproduce: =======================
Using Sample App - https://dl.dropboxusercontent.com/u/62849286/Bugs/BugListviewDeselect/ListviewSelectTest.zip

** The TOP listview is where the bug resides
** The BOTTOM listview functions as expected

[TOP - Bugged Listview]
1. Load the app
2. Select one of the names from the TOP listview (name #1)
3. Click on a different name (#2)
4. Click on the same name again (#2)
 - Note that same list item is still visually selected, but according to the code (and the Application Output), if the same record is clicked as the previous, the current item should be unselected.  
 - Note the app output, Deselection was attempted, but did not work
5. Clicking on the same name (#2), again... will now clear the selection correctly
6. Once cleared, clicking the same name (#2) again will clear the selection immediately
7. Clicking on a different name starts the whole process over again

[BOTTOM - Working Listview]
1. Load the app (no need to reload if already running)
2. Select one of the names from the BOTTOM listview (name #1)
 - Note that the name is deselected immediately
3. Select another name, which will also be deselected immeditly

[Screencasts]
- Android (best example)- http://screencast.com/t/eRsxWHtMMJp
- iOS - http://screencast.com/t/6izlastuaQ2M

[Code Snips]
- Clears selection when previous record is selected, but requires *several* clicks
 o https://gist.github.com/mattregul/c1356a808a20b1a2c734#file-testpage-xaml-cs-L56-L72

- Clears when any record is selected
 o https://gist.github.com/mattregul/c1356a808a20b1a2c734#file-testpage-xaml-cs-L91-L108


== Actual Results: ===========================
For unknown reasons, multiple calls of `List.SelectedItem = null` are required in some situations (possibly when nested?)


== Expected Results: =========================
Regardless of location in code, when `List.SelectedItem = null` is called, the selected item should be deselected


== Build Date & Platform: ====================
Xamarin Forms - 2.0.1.6505
Version Info - https://gist.github.com/mattregul/c1356a808a20b1a2c734#file-version-info-cs