Bug 23382 - ListView cells not rendering correctly on Android
Summary: ListView cells not rendering correctly on Android
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.2.2
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Jason Smith [MSFT]
Depends on:
Reported: 2014-09-25 15:10 UTC by Jon Goldberger [MSFT]
Modified: 2014-10-20 22:17 UTC (History)
5 users (show)

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 Jon Goldberger [MSFT] 2014-09-25 15:10:27 UTC
## Description (From case file):

I am having an issue using a ListView in Xamarin Forms on Android. The main page contains a single ListView that has a custom ViewCell template, an "Add" button and a label that displays a count of "items". The custom template consists of 2 buttons and 2 labels in a horizontal StackLayout. One of the buttons is hidden by default. Backing the application are 2 view models. The main view model (ViewModel1) contains an Observablecollection of view models (ViewModel2) that are used as the ItemsSource for the ListView.

I am trying to implement the following behavior:

1. The user taps the "Add" button at the bottom of the page - This adds a new ViewModel2 to the ObservableCollection and through binding is reflected in the ListView

2. The user taps the button labeled "TOGGLE" on the ListView item - This shows the second button labeled "INCREMENT" at the start of the ViewCell, all other controls in the ViewCell are pushed to the right

3. The user taps the "INCREMENT" button to increment a counter - The incremented value is shown in the ViewCell in red text and also updates a total count in the main page

4. The user taps the "TOGGLE" button again and the "INCREMENT" button is hidden and the ViewCell UI collapses left back to its original state

Everything works in Android up to step 4. When the user taps the "TOGGLE" button again the "INCREMENT" button is hidden BUT the UI does not update and collapse back to the left. The space is just left empty at that point. Adding additional items to the list at this point results in undefined behavior. I suspect this has something to do with reuse of cells in Android but because this is in Forms I cannot dig in deep enough to find the issue.

## Steps to reproduce:

1. Open attached test project and launch the Android project.
2. Add some list items.
3. Toggle some of the items.
4. Click and increment button.
5. Click Toggle again.
6. Toggle some items to see the behavior shown in the Android screen cast below. ON my end, the issue seems to mostly occur with the first few items on the list.

## Expected result

When clicking toggle, the increment button will appear and the Toggle button and the text will move to the right to make room for the increment button.

## Actual result

In some items, clicking toggle will add the increment button but the other item elements remain in place.

## screencast of issue. Note, iOS does not display this issue.

iOS Screen cast: http://screencast.com/t/1KDaIuOr8
Android Screen cast: http://screencast.com/t/GlXVgwgi

## Notes

Tested using Forms version Erroneous behavior seems to start only after an increment button is pressed.
Comment 3 Jason Smith [MSFT] 2014-10-20 22:17:45 UTC
This should be resolved in 1.3.0