Xamarin.forms ListView 项目不可见
Xamarin.forms ListView Items not visible
我在我的 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?
修复解决方案:
尝试
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
}
但其他页面可能存在颜色问题,请尝试检查所有页面
谢谢
我在我的 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?
修复解决方案: 尝试
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
}
但其他页面可能存在颜色问题,请尝试检查所有页面 谢谢