21
Dec
07

Customizing the Flex ComboBox control’s text input styles

The following example shows how you can customize the ComboBox control’s text input styles by setting the textInputStyleName style in Flex.

Full code after the jump.

View MXML

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/12/21/customizing-the-flex-combobox-controls-text-input-styles/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="top"
        backgroundColor="white">

    <mx:Style>
        ComboBox {
            textInputStyleName: myCustomTextInputStyleName;
        }

        .myCustomTextInputStyleName {
            color: red;
            fontStyle: italic;
            fontWeight: bold;
        }
    </mx:Style>

    <mx:ApplicationControlBar dock="true">
        <mx:Form styleName="plain">
            <mx:FormItem label="editable:">
                <mx:CheckBox id="checkBox"
                        selected="false" />
            </mx:FormItem>
        </mx:Form>
    </mx:ApplicationControlBar>

    <mx:ComboBox id="comboBox"
            editable="{checkBox.selected}"
            creationComplete="comboBox.open();">
        <mx:dataProvider>
            <mx:Array>
                <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:Array>
        </mx:dataProvider>
    </mx:ComboBox>

</mx:Application>

View source is enabled in the following example.


2 Responses to “Customizing the Flex ComboBox control's text input styles”


  1. 1 Sergiy Feb 19th, 2008 at 2:38 am

    Why this is not working in Flex Builder 2 (2.0.1)?
    Is this only for FB3?

  2. 2 Kevin Sep 8th, 2008 at 8:54 pm

    Question: I like the ComboBox to have the both the Left and Right sides curved like they currently appear when the ComboBox is NOT editable, but my goal is to make it look the same when the ComboBox is EDITABLE. Is this possible in either Flex 2 or 3? I have both, but I do not see the function to make it happen.

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;".




December 2007
M T W T F S S
« Nov   Jan »
 12
3456789
10111213141516
17181920212223
24252627282930
31  

Badge Farm

  • Powered by Redoable 1.2
  • Cornify
  • Feeds burnt by Feedburner
  • Feed