alternating – Owl's Blog on .NET development http://www.componentowl.com/blog Component Owl codes Better ListView control all night so you don't have to. Tue, 04 Sep 2018 13:10:05 +0000 en-US hourly 1 https://wordpress.org/?v=4.9.8 Alternating Rows in Better ListView http://www.componentowl.com/blog/alternating-rows-in-better-listview/ http://www.componentowl.com/blog/alternating-rows-in-better-listview/#respond Tue, 22 Apr 2014 22:38:15 +0000 http://www.componentowl.com/blog/?p=888 Alternating Rows

Alternating Rows

Lists with alternating row colors are more readable. It is very simple to implement alternating rows in Better ListView.

Simply add DrawItemBackground event handler and fill background on odd/even items:

 

[csharp gutter=”false” toolbar=”false”]
private void ListViewOnDrawItemBackground(object sender, BetterListViewDrawItemBackgroundEventArgs eventArgs)
{
if ((eventArgs.Item.Index & 1) == 1)
{
eventArgs.Graphics.FillRectangle(Brushes.AliceBlue, eventArgs.ItemBounds.BoundsOuter);
}
}
[/csharp]

]]>
http://www.componentowl.com/blog/alternating-rows-in-better-listview/feed/ 0