17
Aug
07

Alternating row colors in a Flex List control

The following example shows how you can alternate row colors in a List control using the alternatingItemColors style.

Full code after the jump

View MXML

<?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”


  1. No Comments

Leave a Reply

This blog is terrible at eating HTML tags. If you plan on posting code/XML, please escape your "<" characters as "&lt;" and your ">" characters as "&gt;".




Badge Farm

  • Firefox 2
  • Powered by Redoable 1.2
  • Feeds burnt by Feedburner
  • Feed