The following example shows how you can remove the border skin on a Flex List control by setting the borderSkin style to null using MXML, CSS, and ActionScript.
Full code after the jump.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2009/02/02/removing-the-border-skin-on-a-list-control-in-flex/ -->
<mx:Application name="List_borderSkin_test"
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:List id="list"
dataProvider="[Red,Orange,Yellow,Green,Blue]"
borderSkin="{null}"
width="100" />
</mx:Application>
You can also set the borderSkin style in an external .CSS file or <Style> block, as seen in the following example:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2009/02/02/removing-the-border-skin-on-a-list-control-in-flex/ -->
<mx:Application name="List_borderSkin_test"
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Style>
List {
borderSkin: ClassReference(null);
}
</mx:Style>
<mx:List id="list"
dataProvider="[Red,Orange,Yellow,Green,Blue]"
width="100" />
</mx:Application>
Or, you can set the borderSkin style using ActionScript, as seen in the following example:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2009/02/02/removing-the-border-skin-on-a-list-control-in-flex/ -->
<mx:Application name="List_borderSkin_test"
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Script>
<![CDATA[
private function init():void {
list.setStyle("borderSkin", null);
}
]]>
</mx:Script>
<mx:List id="list"
dataProvider="[Red,Orange,Yellow,Green,Blue]"
width="100"
initialize="init();" />
</mx:Application>

{ 4 comments… read them below or add one }
Thank you for posting this!
I had to restyle an entire app for a client and couldn’t find this anywhere. I began extending the list class to do this but decided to search around one more time.
I’m using spark.components.list and for this the borderSkin does not exist…. Hence I get a compile error. Do you have any solution for this?
@Robin,
The mx.controls.List and spark.components.List are completely different controls with different APIs. You’d modify the Spark List control’s appearance by creating a custom skin instead. For more information on the Halo/MX and Spark controls, see the beta Flex 4 Language Reference at http://livedocs.adobe.com/flex/gumbo/langref/.
Peter
Is there a way to remove the List border highlight that happens when an item is dragged out or into a List?