Udostępnij za pośrednictwem


CalendarView.DayOfWeekFormat Property

Definition

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

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"/>

Property Value

String

Platform::String

winrt::hstring

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.

Applies to