I have a List with an itemRenderer for displaying some data. Is there anyway i can set different styles or background colors for alternate rows?
My List is as follows :
<mx:List id="myList" alternatingItemColors="[0xffffff, 0xe4e4e4]"
borderStyle="none"
width="100%" height="100%" y="25"
dataProvider="{infoColl}"
styleName="listRendererStyle"
itemRenderer="InfoRenderer"/>
Look at the code of
spark.skins.spark.DefaultItemRendereras a pattern. There is the following code to get background color (see inupdateDisplayList):But if you’re using
spark.components.supportClasses.ItemRendereras a base class for your MXML renderer just setautoDrawBackgroundproperty totrueand all the backgrounds will be drawn automatically.Or read the following documentation how to set
alternatingItemColorsstyle of the list to change the values of alternating rows.