设置DateChooser控件的头部文字对齐方式.
DateChooser控件的textAlign 和 headerStyleName 样式。
示例:
示例:
代码:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/06/05/aligning-headers-in-a-datechooser-control-in-flex/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Script>
<![CDATA[
import mx.events.ListEvent;
private function comboBox_change(evt:ListEvent):void {
var cssObj:CSSStyleDeclaration = StyleManager.getStyleDeclaration(".dateChooserHeaderStyles");
cssObj.setStyle("textAlign", comboBox.selectedItem);
}
]]>
</mx:Script>
<mx:Style>
.dateChooserHeaderStyles {
fontWeight: bold;
textAlign: left;
}
</mx:Style>
<mx:ApplicationControlBar dock="true">
<mx:Form styleName="plain">
<mx:FormItem label="textAlign:">
<mx:ComboBox id="comboBox"
dataProvider="[left,center,right]"
change="comboBox_change(event);" />
</mx:FormItem>
</mx:Form>
</mx:ApplicationControlBar>
<mx:DateChooser id="dateChooser"
headerStyleName="dateChooserHeaderStyles" />
</mx:Application>
<!-- http://blog.flexexamples.com/2008/06/05/aligning-headers-in-a-datechooser-control-in-flex/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Script>
<![CDATA[
import mx.events.ListEvent;
private function comboBox_change(evt:ListEvent):void {
var cssObj:CSSStyleDeclaration = StyleManager.getStyleDeclaration(".dateChooserHeaderStyles");
cssObj.setStyle("textAlign", comboBox.selectedItem);
}
]]>
</mx:Script>
<mx:Style>
.dateChooserHeaderStyles {
fontWeight: bold;
textAlign: left;
}
</mx:Style>
<mx:ApplicationControlBar dock="true">
<mx:Form styleName="plain">
<mx:FormItem label="textAlign:">
<mx:ComboBox id="comboBox"
dataProvider="[left,center,right]"
change="comboBox_change(event);" />
</mx:FormItem>
</mx:Form>
</mx:ApplicationControlBar>
<mx:DateChooser id="dateChooser"
headerStyleName="dateChooserHeaderStyles" />
</mx:Application>