Bug 34720 - [Forms] Incorrect iOS button IsEnabled when scrolling ListView with command binding
Summary: [Forms] Incorrect iOS button IsEnabled when scrolling ListView with command b...
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: 1.5.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Rui Marinho
Depends on:
Reported: 2015-10-09 11:25 UTC by Matthew Regul
Modified: 2015-10-28 04:26 UTC (History)
4 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 on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Matthew Regul 2015-10-09 11:25:41 UTC

Sample Project

When using buttons within a Cell view and Binding them to a command on the item view model, the binding gets out of sync when new ViewCells are created/reused during normal scrolling/updates.  This is observable when scrolling the list back and forth quickly or reloading the Bound List item source property (most apparent).

The theory is the button's isEnabled property not getting updated because it is indirectly bound to the Commands CanExecute Method via the command binding, and when the ViewCell is recycled it does not re-query the Command for the IsEnabled value.

We have tried binding the IsEnable property separately but is does not take effect when using command binding, and have had to resort to binding the IsVisible property to hide the buttons.

(This issue is not observable on Android, also included in the project)

**Steps to Reproduce:**
Run the sample multiple times as the issue is somewhat random when scrolling the list and depends on the speed of the scrolling. Also scrolling back to the top of the list will show a jumbled up list 

Using the pull to refresh on the list cause the issue to consistently appear.

**Actual Results:**
Buttons in the same list position will switch enabled state when the view cell is reused. Some that are originally enabled but after scrolling to the bottom of the list and back to the top they are not.

Screenshot - https://dl.dropboxusercontent.com/u/62849286/Cases/220804/example.png

**Expected Results:**
The correct button states, based on the IsEnabled values

**Build Date & Platform:**
Reproduced with:
- XF 1.3
- XF
- XF 1.5.1-pre1

**Additional Information:**
Comment 2 Rui Marinho 2015-10-20 05:51:27 UTC
Hi Matthew, we can suggest a workaround: using the pre release version 1.5.2 and setting ListViewCachingStrategy.RecycleElement on the ListView constructor should do the trick.
Comment 3 Matthew Regul 2015-10-20 10:16:36 UTC
Awesome!  Thanks Rui!
Comment 4 Jason Smith [MSFT] 2015-10-28 04:26:24 UTC
Should be fixed in 1.5.2-pre2