Skip to content

Latest commit

 

History

History
71 lines (49 loc) · 4.68 KB

datepicker_calendaridentifier.md

File metadata and controls

71 lines (49 loc) · 4.68 KB
-api-id -api-type
P:Windows.UI.Xaml.Controls.DatePicker.CalendarIdentifier
winrt property

Windows.UI.Xaml.Controls.DatePicker.CalendarIdentifier

-description

Gets or sets the calendar system to use.

-xaml-syntax

<DatePicker CalendarIdentifier="calendarSystem"/>

-xaml-values

calendarSystem
calendarSystemThe name of the calendar system to use. See Remarks.
## -property-value The calendar system to use.

-remarks

The DatePicker supports each of the calendar systems supported by Windows. These calendars are specified in the Windows.Globalization.CalendarIdentifiers class. The DatePicker uses the correct calendar for your app's default language, or you can set the CalendarIdentifier property to use a specific calendar system.

To set the CalendarIdentifier in XAML, use the identifier string. To set it in code, use the corresponding CalendarIdentifiers property. See the Examples section.

This table lists the supported calendar systems. See the CalendarIdentifiers documentation for more information about each calendar system.

Calendar systemIdentifier stringLocalized?
Gregorian"GregorianCalendar"Yes.
Hebrew"HebrewCalendar"No. Strings always in Hebrew.
Hijri"HijriCalendar"No. Strings always in Arabic.
Japanese"JapaneseCalendar"No. Strings always in Japanese.
Julian"JulianCalendar"Yes.
Korean"KoreanCalendar"Yes.
Taiwan"TaiwanCalendar"Yes.
Thai"ThaiCalendar"Yes.
UmAlQura"UmAlQuraCalendar"No. Strings always in Arabic.

The string content of each ComboBox in the DatePicker is created by a DateTimeFormatter. The DateTimeFormatter uses the CalendarIdentifier set on the DatePicker to determine which calendar to use to format the content. If the CalendarIdentifier is not set, the DateTimeFormatter uses the default calendar for the app’s preferred language (see ApplicationLanguages).

If the specified calendar system is localized, it will display in the app’s preferred language. For example, if you specify a Korean calendar and the app language is "en-us", the DatePicker will display in English because there are translations for the Korean calendar. However, if you specify a Japanese calendar and the app preferred language is "en-us", the DatePicker will still display in Japanese because there are no translations for the Japanese calendar.

-examples

To set the CalendarIdentifier in XAML, use the identifier string, as shown here.

<DatePicker x:Name="julianDatePicker" CalendarIdentifier="JulianCalendar"/>

To set the CalendarIdentifier on code, use the value returned by the corresponding CalendarIdentifiers property, as shown here.

DatePicker julianDatePicker = new DatePicker();
julianDatePicker.CalendarIdentifier = Windows.Globalization.CalendarIdentifiers.Julian;

-see-also

CalendarIdentifiers, DateTimeFormatter.Calendar, Date picker