07
Jan
08

Setting the button corner radius in a Flex ButtonBar control

The following example shows how you can set the corner radius on a ButtonBar control in Flex by setting the buttonStyleName and cornerRadius styles.

Full code after the jump.

View MXML

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/01/07/setting-the-button-corner-radius-in-a-flex-buttonbar-control/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">

    <mx:Style>
        .myCustomButtonStyleName {
            cornerRadius: 16;
        }
    </mx:Style>

    <mx:Array id="arr">
        <mx:Object label="Button" />
        <mx:Object label="ButtonBar" />
        <mx:Object label="CheckBox" />
        <mx:Object label="ColorPicker" />
    </mx:Array>

    <mx:ButtonBar id="buttonBar"
            buttonStyleName="myCustomButtonStyleName"
            dataProvider="{arr}"
            height="32" />

</mx:Application>

View source is enabled in the following example.

If you want to set the buttonStyleName style using an external .CSS file or <mx:Style /> block, you can use code similar to the following snippet:

<mx:Style>
    ButtonBar {
        buttonStyleName: myCustomButtonStyleName;
    }

    .myCustomButtonStyleName {
        cornerRadius: 16;
    }
</mx:Style>

1 Response to “Setting the button corner radius in a Flex ButtonBar control”


  1. 1 abhishek Apr 21st, 2009 at 7:29 am

    hello friends,
    could we add upskin and selcted skin to this buttonBar with corner radious?
    thx u in advanced,
    abhishekchess1@gmail.com
    :)

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

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