So I'm using C# in a Windows Forms Application and my question here is about the ListView. All I want to do is display the ListViewItem in a certain colour depending on the value. Now I have tried the traditional method of:
ListViewItem li = new ListViewItem();
li.ForeColor = Color.Green;
li.Text = "Limit: " + wc.getCreditLimit();
listLimits.Items.Add(li);
But the result I see in the ListView is:
ListViewItem:{Limit:15000}
And no, it's not coloured
Another method I tried was to initialise the ListViewItem with text as an argument like so:
ListViewItem li = new ListViewItem("Limit: " + wc.getCreditLimit());
li.ForeColor = Color.Green;
listLimits.Items.Add(li);
But that also produces the same result as before.
Another Method I tried was do add the Text property of the ListViewItem like so:
ListViewItem li = new ListViewItem("Limit: " + wc.getCreditLimit());
li.ForeColor = Color.Green;
listLimits.Items.Add(li.Text);
Now this displays the correct text in the ListView, however It's still not coloured!
Can someone please explain this odd behaviour because from what I've read, it looks like this is the only approach to adding colour to a ListViewItem. Any advice would be appreciated, thanks.