Bug 21429 - Listview bug in Android
Summary: Listview bug in Android
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.1.1
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Eric Maupin
URL:
Depends on:
Blocks:
 
Reported: 2014-07-18 06:57 UTC by rolf-hje
Modified: 2015-05-14 19:02 UTC (History)
5 users (show)

Tags:
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:
RESOLVED FIXED

Description rolf-hje 2014-07-18 06:57:22 UTC
When I focus the entry field and write anything and press the complete button I expect the lisst to update it's items With datetime values, but the original "Central A" ... remains in the list. If I check the actual TmpList values it contains the correct datetime values, but the list does not show it.

This is an android problem.

Code to reproduce the issue :

/// <summary>

/// 

/// </summary>

public class SelectPage : ContentPage

{
    ObservableCollection<Central> TmpList
        = new ObservableCollection<Central>();

    /// <summary>
    /// 
    /// </summary>
    public class Central : INotifyPropertyChanged
    {
        private string m_Name;


        /// <summary>
        /// 
        /// </summary>
        /// <param name="Name"></param>

        public Central(string Name)
        { this.Name = Name; }


        /// <summary>
        /// 
        /// </summary>
        public string Name
        {
            set
            {
                m_Name
                    = value;

                if (PropertyChanged != null)
                    PropertyChanged(this, new PropertyChangedEventArgs("Name"));
            }
            get
            {
                return m_Name;
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
    };



    public class CentralCell : ViewCell
    {
        public CentralCell()
        {
            var imageCentral = new Image()
            {
                Source = ImageSource.FromResource("<namespace>.Select.png")
            };

            var labelCentral = new Label()
            {
                YAlign = TextAlignment.Center,
                XAlign = TextAlignment.Start,
            };

            labelCentral.SetBinding(Label.TextProperty, "Name");

            this.View = new StackLayout
            {
                Padding = new Thickness(0, 10),
                Spacing = 10,
                Orientation = StackOrientation.Horizontal,
                Children =
                {
                    imageCentral, labelCentral
                }
            };
        }
    }

    public SelectPage()
    {
        var editStreet = new Entry
        {
            Keyboard = Keyboard.Text,
        };

        TmpList.Add(new Central("Central A"));
        TmpList.Add(new Central("Central B"));
        TmpList.Add(new Central("Central C")); 

        var listCentral = new ListView
        {
            ItemsSource = TmpList,
            ItemTemplate = new DataTemplate(typeof(CentralCell)),
        };


        editStreet.Focused += (sender, args) =>
        {
            listCentral.IsVisible
                = false;
        };


        editStreet.Completed += (sender, args) =>
        {
            TmpList.Clear();
            TmpList.Add(new Central(DateTime.Now.ToString()));
            TmpList.Add(new Central(DateTime.Now.ToString()));
            TmpList.Add(new Central(DateTime.Now.ToString())); 

            listCentral.IsVisible
                = true;
        };

        Content = new ScrollView
        {
            Content = new StackLayout
            {
                Spacing = 15,
                Children = { editStreet, listCentral }
            }
        };
    }
}
Comment 1 Arpit Jha 2014-08-20 08:18:44 UTC
I have Checked this issue and able to reproduce it.

Steps to reproduce:
1.Create an Mobile PCL App.
2.Add a .cs class and  add implement code given in Comment 0.
3.Run the Application and observed that list does not display.

ScreenCast:  http://screencast.com/t/CxNyZMF6

Environment Info:

XVS 3.3.47.0 

Xamarin Forms:1.0.6186
Comment 2 Eric Maupin 2015-05-14 19:02:55 UTC
This appears to have been fixed.