CalendarView.DayOfWeekFormat CalendarView.DayOfWeekFormat CalendarView.DayOfWeekFormat CalendarView.DayOfWeekFormat Property

Definition

Gets or sets the display format for the day of the week headers.

public : Platform::String DayOfWeekFormat { get; set; }
winrt::hstring DayOfWeekFormat();

void DayOfWeekFormat(winrt::hstring dayofweekformat);
public string DayOfWeekFormat { get; set; }
Public ReadWrite Property DayOfWeekFormat As string
<CalendarView DayOfWeekFormat="formatString"/>

Property Value

string string

The display format for the day of the week header values.

Examples

Here's a CalendarView with the day of week headers formatted to show the 3 letter abbreviation.

<CalendarView DayOfWeekFormat="{}{dayofweek.abbreviated(3)}"/>

Here's the same formatting option set in code.

CalendarView calendarView1 = new CalendarView();
calendarView1.DayOfWeekFormat = "{dayofweek.abbreviated(3)}";

Remarks

Change the format of the day of the week headers by setting the DayOfWeekFormat property.

The string content of each day of the week header is created by a DateTimeFormatter. You inform the DateTimeFormatter how to format the day value by providing a format pattern string. Common patterns for day values are listed in the following table.

format pattern example
{dayofweek.abbreviated} Sun Mon Tue
{dayofweek.abbreviated(2)} Su Mo Tu
{dayofweek.abbreviated(3)} Sun Mon Tue
{dayofweek.solo.abbreviated} Sun Mon Tue
{dayofweek.solo.abbreviated(2)} Su Mo Tu
{dayofweek.solo.abbreviated(3)} Sun Mon Tue

Caution

When you use a format pattern in XAML, you need to include a set of empty braces before the format string, like this: DayOfWeekFormat="{}{dayofweek.abbreviated}" Also see Examples.

For more info about format patterns, including when to use the solo options, see the Remarks section of the DateTimeFormatter class documentation.

Note

You can set this property to any valid date/time format, but formats other than those listed previously don't make sense for the day of week header.