【问题标题】:Xamarin.forms ListView Items not visibleXamarin.forms ListView 项目不可见
【发布时间】:2017-02-22 14:59:37
【问题描述】:

我在我的 Droid 项目上将 xamarin.forms 从 v2.0.1.6505 更新到 v2.3.3.180, 我有以下ListView(简单的一个):

  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;        
    }
}

我得到以下列表(项目不可见)

为什么在我更新 Xamarin.forms 后出现此问题?

【问题讨论】:

  • 客户是否包含数据? EntityViewCell 是什么样的?尝试使用简单的 TextCell 代替,如果可行,您就知道问题出在自定义单元格中,如果不是,那么您的数据源可能是问题所在。
  • 客户包含信息,我会更新问题

标签: c# listview xamarin.android xamarin.forms portable-class-library


【解决方案1】:

修复解决方案: 试试

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         
        }

但可能颜色问题包含在其他页面上,请尝试检查所有页面 谢谢

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多