The following example shows how you can alternate row colors in a List control using the alternatingItemColors style.
Full code after the jump
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/08/17/alternating-row-colors-in-a-flex-list-control/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:ArrayCollection id="arrColl">
<mx:source>
<mx:Array>
<mx:Object label="Row 1" />
<mx:Object label="Row 2" />
<mx:Object label="Row 3" />
<mx:Object label="Row 4" />
<mx:Object label="Row 5" />
<mx:Object label="Row 6" />
<mx:Object label="Row 7" />
<mx:Object label="Row 8" />
</mx:Array>
</mx:source>
</mx:ArrayCollection>
<mx:List id="list"
alternatingItemColors="[0xEEEEEE, 0xDFDFDF]"
dataProvider="{arrColl}"
rowCount="4"
width="200" />
</mx:Application>
View source is enabled in the following example.




0 Responses to “Alternating row colors in a Flex List control”
Leave a Reply