CalendarView.DayOfWeekFormat 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置星期几标题的显示格式。
public:
property Platform::String ^ DayOfWeekFormat { Platform::String ^ get(); void set(Platform::String ^ value); };
winrt::hstring DayOfWeekFormat();
void DayOfWeekFormat(winrt::hstring value);
public string DayOfWeekFormat { get; set; }
var string = calendarView.dayOfWeekFormat;
calendarView.dayOfWeekFormat = string;
Public Property DayOfWeekFormat As String
<CalendarView DayOfWeekFormat="formatString"/>
属性值
星期几标题值的显示格式。
示例
下面是一个 CalendarView,其星期几标题的格式为显示 3 个字母缩写。
<CalendarView DayOfWeekFormat="{}{dayofweek.abbreviated(3)}"/>
下面是代码中设置的相同格式设置选项。
CalendarView calendarView1 = new CalendarView();
calendarView1.DayOfWeekFormat = "{dayofweek.abbreviated(3)}";
注解
通过设置 DayOfWeekFormat 属性更改星期几标题的格式。
星期中的每一天的字符串内容由 DateTimeFormatter 创建。 通过提供格式模式字符串,通知 DateTimeFormatter 如何设置日期值的格式。 下表列出了日值的常见模式。
| 格式模式 | 示例 |
|---|---|
| {dayofweek.abbreviated} | 太阳星期二 |
| {dayofweek.abbreviated(2)} | 苏莫图 |
| {dayofweek.abbreviated(3)} | 太阳星期二 |
| {dayofweek.solo.abbreviated} | 太阳星期二 |
| {dayofweek.solo.abbreviated(2)} | 苏莫图 |
| {dayofweek.solo.abbreviated(3)} | 太阳星期二 |
注意
在 XAML 中使用 格式模式 时,需要在格式字符串之前包含一组空大括号,如下所示: DayOfWeekFormat="{}{dayofweek.abbreviated}" 另请参阅示例。
有关格式模式的详细信息,包括何时使用 独奏 选项,请参阅 DateTimeFormatter 类文档的“备注”部分。
注释
可以将此属性设置为任何有效的日期/时间格式,但前面列出的日期/时间格式对星期几标题没有意义。