Flex DateChooser - 周/周末的字体颜色差异
我希望在工作日和周末的 DateChooser / CalendarLayout 中看到不同的颜色。我还想使用自定义样式名称来实现这一点(例如:“weekColor”和“weekendColor”。
知道如何实现这一点吗?
欢呼, 瑞克
I would like to see different colors in my DateChooser / CalendarLayout for weekdays and weekend days. I would also like to achieve this using a custom stylename (for example: "weekColor" and "weekendColor".
Any idea how this can be achieved?
Cheer,
Rick
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我花了几天时间但我发现了。因此,供将来参考:这是我的解决方案:
我扩展了 DateChooser 并在函数 updateDisplayList(w:Number, h:Number) 上添加了覆盖(在此函数中,已设置 SMTWTFS 日期名称)。
在 updateDisplayList 中,您可以获得 mx_internal::dateGrid.dayBlockArrays[column][row] 包含 CalendarLayout 的所有值。在该数组/数组中,每列的第一行是 SMTWTFS 中的某一天。其他行是日期。一旦我发现这一点,就需要确定周末是什么并相应地调整颜色。如下所示:
在 CSS 文件中,我添加了以下样式:
cornerRadius: 0;
标题颜色:#FFFFFF、#FFFFFF;
今天颜色:#00448c;
边框样式:无;
dropShadowEnabled:假;
字体家族:myGeorgia;
dayNamesBackgroundColor:#ECECEC;
weekHeaderColor:#444444;
周末标题颜色:#DDDDDD;
周颜色:#00317F;
周末颜色:#DDDDDD;
headerStyleName: "dateChooserHeaderStyle";
comboBoxStyleName: "comboBoxStyleName";
这里最
有趣的样式是自定义样式“dayNamesBackgroundColor”(用于为 SMTWTFS 集提供背景颜色)和自定义样式“weekendHeaderColor”、“weekHeaderColor”、“weekColor”、“weekendColor”
我读了这些颜色在上面的方法中,可以完全控制周/周末颜色的差异,其中 SMTWTFS 设置可能会获得与天数不同的颜色
希望这会在将来帮助其他人。我花了很多时间才弄清楚:)
It took me a couple of days but I found it out. So for future reference: here is my solution:
I extended the DateChooser and added an override on the function updateDisplayList(w:Number, h:Number) (In this function the SMTWTFS day names have been set).
In the updateDisplayList you can get the mx_internal::dateGrid.dayBlockArrays[column][row] Containing all the values for the CalendarLayout. In that array / array the first row on each column is the one of the SMTWTFS days. The other rows are the dayNumbers. Once I found that out it is a matter of determining what a weekend day was and adjust the colors accordingly. As I show below:
In the CSS file I added the following styles:
cornerRadius: 0;
headerColors: #FFFFFF, #FFFFFF;
todayColor: #00448c;
border-style:none;
dropShadowEnabled: false;
fontFamily: myGeorgia;
dayNamesBackgroundColor: #ECECEC;
weekHeaderColor:#444444;
weekendHeaderColor:#DDDDDD;
weekColor:#00317F;
weekendColor: #DDDDDD;
headerStyleName: "dateChooserHeaderStyle";
comboBoxStyleName: "comboBoxStyleName";
}
The most interesting styles here are the custom style "dayNamesBackgroundColor" (which is used to give a background color to the SMTWTFS set) and the custom styles "weekendHeaderColor", "weekHeaderColor", "weekColor", "weekendColor"
I read these colors in the method above to get full control for the difference in week/weekend colors where the SMTWTFS set could get different colors than the day number
Hope this will help other people in the future. Took me a lot of time to figure it out :)
我为客户做了类似的事情。该方法是扩展 CalendarLayout 类以接受这些样式并修改相关日期的样式。然后扩展 DateChooser 以接受这些相同的样式并将它们传递给新的 CalendarLayout 类。
这很乏味;你很可能会遇到私有变量问题;但这是可行的。
I did something similar for a client. The approach is to extend the CalendarLayout class to accept those styles and modify the styling on the relevant days. Then extend the DateChooser to accept those same styles and pass them on to your new CalendarLayout class.
It's tedious; and you'll most likely run into private variable issues; but it is doable.