Rui
Rui

Reputation: 5920

Flex 3: List with custom item renderer with "zebra striping" style

I want to apply a "zebra striping" style to my mx:List, the only way to do this is through code right? In that case how can I loop the items (in fact, items or item renderers?) to apply the individual background color?

Thanks in advance!

Upvotes: 0

Views: 523

Answers (2)

The_asMan
The_asMan

Reputation: 6403

Very easy

 <mx:TileList id="tileList" alternatingItemColors="[#FFFFFF,#CCCCCC,#999999]" />

Upvotes: 1

shaunhusain
shaunhusain

Reputation: 19748

Create an item renderer, in doing so extend from UIComponent implement IListItemRenderer and IDataRenderer. You can then use listData.owner.dataProvider.indexOf(data) to get the index of the element the renderer is drawing if thatIndex%2==0 it's an even index otherwise it's an odd index.

Upvotes: 0

Related Questions