Search code examples
c#listviewxamarin.androidxamarin.formsportable-class-library

Xamarin.forms ListView Items not visible


I update xamarin.forms From v2.0.1.6505 to v2.3.3.180 on my Droid Project, I have the following ListView(simple one):

  customersListView = new ListView() {
                ItemsSource = customers,
                ItemTemplate = new DataTemplate(typeof(EntityViewCell)),
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand,   
                SeparatorColor = Color.Teal            
            };
  public class EntityViewCell : ImageCell
  {
    public EntityViewCell() : base()
    {
        SetBinding(TextProperty, new Binding("Name"));
        SetBinding(DetailProperty, new Binding("Description"));
        SetBinding(ImageSourceProperty, new Binding("ImageUrl"));
        TextColor = Color.Blue;        
    }
}

I get the following List(Items are not visible)

enter image description here

Why the issue occurred after I update Xamarin.forms?


Solution

  • Fix solution: try

    public EntityViewCell() : base()
            {
                SetBinding(TextProperty, new Binding("Name"));
                SetBinding(DetailProperty, new Binding("Description"));
                SetBinding(ImageSourceProperty, new Binding("ImageUrl"));
                TextColor = Color.Blue;//or any other color         
            }
    

    but maybe the issue of color contains on other pages, try to check all pages thanks