DatePicker.CalendarIdentifier Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the calendar system to use.
public:
property Platform::String ^ CalendarIdentifier { Platform::String ^ get(); void set(Platform::String ^ value); };
winrt::hstring CalendarIdentifier();
void CalendarIdentifier(winrt::hstring value);
public string CalendarIdentifier { get; set; }
var string = datePicker.calendarIdentifier;
datePicker.calendarIdentifier = string;
Public Property CalendarIdentifier As String
<DatePicker CalendarIdentifier="calendarSystem"/>
Property Value
The calendar system to use.
Examples
To set the CalendarIdentifier
in XAML, use the identifier string, as shown here.
<DatePicker x:Name="julianDatePicker" CalendarIdentifier="JulianCalendar"/>
To set the CalendarIdentifier
in code, use the value returned by the corresponding CalendarIdentifiers property, as shown here.
DatePicker julianDatePicker = new DatePicker();
julianDatePicker.CalendarIdentifier = Windows.Globalization.CalendarIdentifiers.Julian;
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 system | Identifier string | Localized? |
---|---|---|
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.