C# - Use different fore/back color for each subitem

Frustrating sometimes when you cant even set a simple color.

The C# listview is an awesome control for displaying data, but when you find yourself checking your code over and over to see if its setting the colors correctly, its quite annoying when you find out its a default setting thats fucking up your groove.

You see, .NET has a little flag on the ListViewItem object called 'UseItemStyleForSubItems' that uses the ListViewItem style for all subitems in that row. Most likely enabled by default for performance reasons, but also the cause of alot of wasted time.

ListViewItem lvi = new ListViewItem();
lvi.UseItemStyleForSubItems = false;
 
Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog