DatePicker.CalendarIdentifier property

Applies to Windows and Windows Phone

Gets or sets the calendar system to use.

Syntax


public string CalendarIdentifier { get; set; }


<DatePicker CalendarIdentifier="calendarSystem"/>

XAML Values

calendarSystem

The name of the calendar system to use. See Remarks.

Property value

Type: System.String [.NET] | Platform::String [C++]

The calendar system to use.

Remarks

Set the CalendarIdentifier property to specify the calendar system used by the DatePicker. The DatePicker supports all calendar systems in the CalendarIdentifiers class. 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;

Requirements

Minimum supported client

Windows 8.1

Minimum supported server

Windows Server 2012 R2

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml.Controls
Windows::UI::Xaml::Controls [C++]

Metadata

Windows.winmd

See also

DatePicker
CalendarIdentifiers
DateTimeFormatter.Calendar
Quickstart: Adding a DatePicker

 

 

Show:
© 2015 Microsoft