使用DateChooser 控件显示月份名称、年份名称,并显示包含当月的所有日期的网格(每列标有对应的星期日期)。用户可以选择一个日期、某个日期范围或者多个日期。此控件包含前进和后退箭头按钮,用于改变年份和月份。您可以允许用户选择多个日期,禁止选择特定日期和只限于显示某个日期范围。
DateChooser 的样式控制:
主要属性有:dayNames,headerColors,borderColor,todayColor,todayStyleName,headerStyleName,weekDayStyleName,dropShadowEnabled
- <?xml version="1.0" encoding="utf-8"?>
- <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx"
- xmlns:con="contr.*"
- minWidth="955" minHeight="600" xmlns:views="com.runqianapp.input.views.*">
- <fx:Declarations>
- <!-- 将非可视元素(例如服务、值对象)放在此处 -->
- </fx:Declarations>
- <fx:Style>
- @namespace s "library://ns.adobe.com/flex/spark";
- @namespace mx "library://ns.adobe.com/flex/mx";
- @namespace con "contr.*";
- @namespace views "com.runqianapp.input.views.*";
- mx|DateChooser {
- cornerRadius: 5; /* pixels */
- headerColors: #F5F7FA,#EAF0F5 ;
- borderColor: #A6C9E2;
- fontFamily: verdana;
- todayColor: #FFFFCC;
- todayStyleName: myTodayStyleName;
- headerStyleName: myHeaderStyleName;
- weekDayStyleName: myWeekDayStyleName;
- dropShadowEnabled: true;
- }
- .myTodayStyleName{
- font:verdana;
- color:black;
- }
- .myWeekDayStyleName {
- font:verdana;
- fontWeight: normal;
- }
- .myHeaderStyleName {
- color: #222222;
- fontSize: 14;
- fontWeight: normal;
- }
- </fx:Style>
- <mx:VBox>
- <mx:DateChooser id="dateChooser" dayNames="[日,一,二,三,四,五,六]" />
- <mx:TextArea />
- </mx:VBox>
- </s:Application>