I think there is a problem when customizing the ListView control. I'm trying but not in effect
public class AccountInfo
{
public string AccountType { get; set; }
public int Balance { get; set; }
public int Rating { get; set; }
}
Generate dummy data
public List<AccountInfo> GetAccounts()
{
List<AccountInfo> accounts = new List<AccountInfo>();
for (int i = 0; i < 2000; i++)
{
accounts.Add(new AccountInfo
{
AccountType = i % 3 == 0 ? "Good" : "Bad",
Balance = i,
Rating = i * 2
});
}
return accounts;
}
Add data to the MaterialListView control but has no effect, similarly set the backcolor for the ListView
private void frmMaterial_Load(object sender, EventArgs e)
{
List<AccountInfo> accounts = GetAccounts();
int row = 0;
foreach (var acc in accounts)
{
ListViewItem item = new ListViewItem(new string[] { acc.AccountType, acc.Balance.ToString(), acc.Rating.ToString() });
item.BackColor = row % 2 == 0 ? Color.White : Color.Red;
materialListView1.Items.Add(item);
row++;
}
}