При загрузке Listview с данными отображается черный фон для загрузки каждой отдельной ячейки просмотра.Кто-нибудь знает, чтобы изменить цвет или удалить этот стиль?
Я также пытался загрузить Listview из-за кода.Есть ли способ настроить это?
См. Этот снимок экрана ![enter image description here](https://i.stack.imgur.com/8oJ75.png)
Черный фон происходит до загрузки ячейки вида.
<ContentPage.Content>
<StackLayout>
<Button Pressed="Button_Pressed" Text="Back"/>
<ListView x:Name="MyList" BackgroundColor="LightBlue" HasUnevenRows="False">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid HeightRequest="60" BackgroundColor="Bisque">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Text="{Binding Name}"/>
<Label Grid.Column="1" Text="{Binding Quantity}"/>
<Label Grid.Column="2" Text="{Binding Value}"/>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentPage.Content>
код-позади:
public ObservableCollection<ListItemModel> listItems { get; }
public ListViewPage2 ()
{
listItems = new ObservableCollection<ListItemModel>();
listItems.Add(new ListItemModel { Name = "First", Quantity = 1, Value = "10.00" });
listItems.Add(new ListItemModel { Name = "Secound", Quantity = 2, Value = "20.00" });
listItems.Add(new ListItemModel { Name = "Third", Quantity = 3, Value = "30.00" });
listItems.Add(new ListItemModel { Name = "Third", Quantity = 3, Value = "30.00" });
listItems.Add(new ListItemModel { Name = "Third", Quantity = 3, Value = "30.00" });
listItems.Add(new ListItemModel { Name = "Third", Quantity = 3, Value = "30.00" });
listItems.Add(new ListItemModel { Name = "Third", Quantity = 3, Value = "30.00" });
listItems.Add(new ListItemModel { Name = "Third", Quantity = 3, Value = "30.00" });
listItems.Add(new ListItemModel { Name = "Third", Quantity = 3, Value = "30.00" });
listItems.Add(new ListItemModel { Name = "Third", Quantity = 3, Value = "30.00" });
listItems.Add(new ListItemModel { Name = "Third", Quantity = 3, Value = "30.00" });
listItems.Add(new ListItemModel { Name = "Third", Quantity = 3, Value = "30.00" });
listItems.Add(new ListItemModel { Name = "Third", Quantity = 3, Value = "30.00" });
listItems.Add(new ListItemModel { Name = "Third", Quantity = 3, Value = "30.00" });
listItems.Add(new ListItemModel { Name = "Third", Quantity = 3, Value = "30.00" });
listItems.Add(new ListItemModel { Name = "Third", Quantity = 3, Value = "30.00" });
listItems.Add(new ListItemModel { Name = "Third", Quantity = 3, Value = "30.00" });
listItems.Add(new ListItemModel { Name = "Third", Quantity = 3, Value = "30.00" });
listItems.Add(new ListItemModel { Name = "Third", Quantity = 3, Value = "30.00" });
listItems.Add(new ListItemModel { Name = "Third", Quantity = 3, Value = "30.00" });
listItems.Add(new ListItemModel { Name = "Third", Quantity = 3, Value = "30.00" });
InitializeComponent();
MyList.ItemsSource = listItems;
}
private void Button_Pressed(object sender, System.EventArgs e)
{
Application.Current.MainPage.Navigation.PopModalAsync();
}