In a previous example, “Setting the item background roll over color on a ComboBox control in Flex”, we saw how you could change the item background roll over color for a ComboBox control by setting the rollOverColor style.
The following example shows how you can change the selected item background color for a Flex ComboBox control by setting the selectionColor style.
Full code after the jump.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/07/12/setting-the-selected-item-background-color-on-a-combobox-control-in-flex/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="top"
backgroundColor="white">
<mx:Array id="arr">
<mx:Object label="One" />
<mx:Object label="Two" />
<mx:Object label="Three" />
<mx:Object label="Four" />
<mx:Object label="Five" />
<mx:Object label="Six" />
<mx:Object label="Seven" />
<mx:Object label="Eight" />
<mx:Object label="Nine" />
<mx:Object label="Ten" />
</mx:Array>
<mx:ApplicationControlBar dock="true">
<mx:Form styleName="plain">
<mx:FormItem label="selectionColor:">
<mx:ColorPicker id="colorPicker"
selectedColor="#CCCCCC" />
</mx:FormItem>
</mx:Form>
</mx:ApplicationControlBar>
<mx:ComboBox id="comboBox"
dataProvider="{arr}"
selectionColor="{colorPicker.selectedColor}" />
</mx:Application>
View source is enabled in the following example.





0 Responses to “Setting the selected item background color on a ComboBox control in Flex”
Leave a Reply