Bug 54447 - ListView ContextActions' bound properties does not updated on selected item change
Summary: ListView ContextActions' bound properties does not updated on selected item c...
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.3.4
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-04-04 13:54 UTC by Alexander
Modified: 2018-04-08 17:44 UTC (History)
6 users (show)

Tags: android, contextactions, listview ac
Is this bug a regression?: ---
Last known good build:

Sample demonstrates the problem (304.55 KB, application/x-zip-compressed)
2017-04-04 13:54 UTC, Alexander

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 54447 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 Alexander 2017-04-04 13:54:10 UTC
Created attachment 21186 [details]
Sample demonstrates the problem

In context actions mode you can change the list view item selection.
It should change binding context of menu items, which properties can be bound to item.

To see:
1. Start attached sample on Android;
2. Long tap on any list view item - notice the context action menu item text is bound to list view item text;
3. Tap on another list view item - menu item text does not changed though it's bound to list view item;
4. Tap on menu item - action is invoked for last item selected while menu item text mentions the first one.

The similar problem described in https://bugzilla.xamarin.com/show_bug.cgi?id=33642 and it does not fixed.

In general - context actions menu items should be updated on list view selection change.
Its' _context_ actions, so it should be updated on context change.
Comment 1 Alexander 2017-04-04 13:55:30 UTC
Reproducible on 2.3.2, 2.3.3 and 2.3.4.
Comment 2 Jimmy [MSFT] 2017-04-05 20:38:57 UTC
I am able to reproduce the issue using the attached project in Android. I am confirming this report so the team can investigate further.

As mentioned, when the ContextActions for a cell are open, selecting another cell does not close the ContextActions or update the open one for the new cell. However the command executed when tapping the MenuItem is the command from the new cell instead of the original.

Bug 33642 referenced in the description was for a similar issue that resulted in a crash. The crash was fixed, however the ContextActions still remain open and results in this new issue, so perhaps the desired behavior should be for the ContextActions to be closed when the selected item changes. 

This issue only affects Android due to the way ContextActions work on the platform.

### Version Tests    BAD   BAD   BAD
Comment 3 Alexander 2017-04-06 10:21:43 UTC
I think the most correct way to fix all of the similar issues is to implement ContextActions on Android as context popup menu.

Action mode, currently used, was designed for multi-select list views.
Also it will be more consistent with other platforms implementations.
Comment 4 Adam 2017-04-18 10:17:16 UTC
Same applies for evaluation of CanExecute Commapd properties: Changing the selection does not reflect the result of CanExecute for the binded Command.

E.g. the context MenuItem "delete" for a list of documents containing public and private elements - where only private ones shall be allowed to delete while public are not - does not update when selecting another element.