The Calendar control allows you to set date formats for the calendar header month and day of the week. Let us learn about setting the format in the following sections.
Calendar lets you to set the format used to display the month of the year in the header when the view mode is 'month'. By default, the format is "MMM". However, you can change the format using the HeaderMonthFormat property. The following image shows "MMMM yyyy" format for the displayed calendar month.
The following code demonstrates the change in format of the month by setting HeaderMonthFormat property to "MMMM yyyy":
XAML |
Copy Code
|
---|---|
<calendar:C1Calendar x:Name="calendar" HeaderMonthFormat="MMMM yyyy" HorizontalAlignment="Center" VerticalAlignment="Top"></calendar:C1Calendar> |
Calendar allows you to specify formats for displaying the names of the days in a week and the calendar months. You can set the format for representing the names of days in a week by using DayOfWeekFormat property of the C1Calendar class. The following image shows "dddd" format set for the days of the week in a calendar month.
The following code showcases the use of DayOfWeekFormat property to set the "dddd" day format in Calendar, respectively.
XAML |
Copy Code
|
---|---|
<calendar:C1Calendar x:Name="calendar" DayOfWeekFormat="dddd" HorizontalAlignment="Center" VerticalAlignment="Top"></calendar:C1Calendar> |