Is it possible to change color of a specific item for specific column in Listview
?
Asked
Active
Viewed 6,345 times
0

Ehsan
- 31,833
- 6
- 56
- 65

user2214609
- 4,713
- 9
- 34
- 41
-
Exact same question: http://stackoverflow.com/questions/10234910/changing-the-colour-of-certain-listview-columns – computer10171 Jul 30 '13 at 17:39
-
@user2214609 backcolor or forecolor? – Ehsan Jul 30 '13 at 17:43
2 Answers
1
Given a ListView
named ListView1
.
If you know the name of the column you want to change, then try this:
foreach(ListViewItem theItem in ListView1)
{
if(theItem.Text == "Column Name")
{
theItem.ForeColor = Color.Red;
// You also have access to the list view's SubItems collection
theItem.SubItems[0].ForeColor = Color.Blue;
}
}
Note: Obviously Column Name
is made up and you would need to substitute the real column name. Also, Color.Red
is made up and you can substitute whatever color you want.

Karl Anderson
- 34,606
- 12
- 65
- 80
-
What is exactly 'ListViewItem'? Can you explain that, please? @Karl Anderson – Fernando S. Kroes Mar 10 '16 at 08:42
0
As you haven't mentioned what you want to change so Below is the example to change backcolor and forecolor of a specific subitem in listview
item1.SubItems[1].BackColor = Color.Yellow;
item1.SubItems[1].ForeColor= Color.Yellow;
You can specify your own subitem by column name.

Ehsan
- 31,833
- 6
- 56
- 65