Bug 37841 - [Forms Android] TableView EntryCell's and TextCell's cease to update after focus change
Summary: [Forms Android] TableView EntryCell's and TextCell's cease to update after fo...
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.0.0
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: E.Z. Hart [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2016-01-20 16:02 UTC by Matthew Regul
Modified: 2016-04-21 12:45 UTC (History)
9 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:
Status:
VERIFIED FIXED

Description Matthew Regul 2016-01-20 16:02:10 UTC
**Overview:**
- Screencast - http://screencast.com/t/dL6D5Exh1
- Sample App - https://dl.dropboxusercontent.com/u/62849286/Cases/247866/TableViewTest.zip
- Version Info - https://gist.github.com/mattregul/647a0131bc842310903b#file-version-info-cs

When using a Forms TableView on Android. More specifically, EntryCell and TextCell objects that are bound to data sources are not updating when the data source updates. Our specific use case is that we have a button on the page that causes an update of certain data values. When the data source updates, the new values should be reflected in the TableView. However, this is not happening. We have confirmed that the data is being updated in the data source and that a PropertyChanged event is being raised. Note that it works correctly on iOS.

The simplest way to see the problem is when the TableView is located on a modal page. In this case, the cells will never update.

The second way that we have been able to recreate the problem is if the TableView is on a tab within a TabbedPage. In this case, the first time that you switch to the tab, the cells will update correctly. However, if you switch to another tab and then back, the updates will no longer work.

One interesting thing to note is that the values will update when the cells scroll off the screen and back on, or if you switch tabs and back. Presumably this is because the objects are being destroyed and recreated.

One possible workaround is to use ViewCells with Label and Entry objects. These both appear to work correctly. However, this is not an optimal solution because custom renderers would need to be created in order to style to objects correctly for the different platforms.



**Steps to Reproduce:**
Using the Sample App - https://dl.dropboxusercontent.com/u/62849286/Cases/247866/TableViewTest.zip
================================================
1. Load App (App loads to the C# demo page)
2. Click the "Generate" button
3. Note that every field on the screen was updated with a random number
4. Mutiple "Generate" clicks will update every field
5. Switch to the XAML tab at the top
6. Click the "Generate" button
7. Note that every field on the screen was updated with a random number
8. Mutiple "Generate" clicks will update every field
9. Switch *back* to the C# tab
10. Click the "Generate" button
11. Note that the Entry fields at the top are no longer updating
12. Switching to the XAML page will reveil the same results
13. Added bonus, check out the "Modal C#"" and "Modal XAML" button at the top of the app, the same loss functinality occurs



**Actual Results:**
Interestingly the cells are updated on the fly the initially on both C# and XAML tabs, but when you change focus and back to that tab they cease to update.  (loss of binding?)



**Build Date & Platform:**
- Xamarin.Android - 6.0.1.9
- Xamarin.Forms - 2.0.0.6490
- Full Version List - https://gist.github.com/mattregul/647a0131bc842310903b#file-version-info-cs
Comment 2 Jason Smith [MSFT] 2016-03-10 20:34:51 UTC
Should be fixed in 2.2.0-pre1
Comment 3 Rajneesh Kumar 2016-04-21 12:45:04 UTC
I have checked this issue with the XF 2.2.0.23-pre4 and observed that this issue has been fixed and working as expected.

Screencast: http://www.screencast.com/t/Z0AWy4FO6

This issue has been fixed hence I am closing this issue.

Enviornment Info: https://gist.github.com/Rajneesh360Logica/7707f4e54c14879b63dc16ef72b6dd01