Share via


DatePicker.CalendarIdentifier 屬性

定義

取得或設定要使用的行事曆系統。

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

屬性值

String

Platform::String

winrt::hstring

要使用的行事曆系統。

範例

若要在 XAML 中設定 CalendarIdentifier ,請使用識別符字串,如下所示。

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

若要在程式代碼中設定 CalendarIdentifier ,請使用對應 CalendarIdentifiers 屬性傳回的值,如下所示。

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

備註

DatePicker支援 Windows 支援的每個行事曆系統。 這些行事曆是在 Windows.Globalization.CalendarIdentifiers 類別中指定。 會 DatePicker 針對您應用程式的默認語言使用正確的行事曆,或者您可以將 屬性設定 CalendarIdentifier 為使用特定的行事曆系統。

若要在 XAML 中設定 CalendarIdentifier ,請使用識別符字串。 若要在程式代碼中設定它,請使用對應的 CalendarIdentifiers 屬性。 請參閱<範例>一節。

下表列出支援的行事曆系統。 如需每個行事歷系統的詳細資訊,請參閱 CalendarIdentifiers 檔。

行事曆系統識別碼字串當地語系化?
西曆“GregorianCalendar”是的
Hebrew“希伯來文Calendar”不是 字串一律位於希伯來文中。
Hijri“HijriCalendar”不是 字串一律以阿拉伯文表示。
日文“JapaneseCalendar”不是 字串一律以日文表示。
朱利安“JulianCalendar”是的
韓文“KoreanCalendar”是的
台灣“臺灣Calendar”是的
泰文“ThaiCalendar”是的
UmAlQura“UmAlQuraCalendar”不是 字串一律以阿拉伯文表示。

DatePicker 中每個 ComboBox 的字串內容是由 DateTimeFormatter 所建立。 DateTimeFormatter 會使用 CalendarIdentifierDatePicker 上的 集合來判斷要用來格式化內容的行事曆。 CalendarIdentifier如果未設定 ,DateTimeFormatter 會使用應用程式慣用語言的預設行事曆, (請參閱 ApplicationLanguages) 。

如果指定的行事曆系統已當地語系化,則會以應用程式的慣用語言顯示。 例如,如果您指定韓曆,且應用程式語言為 「en-us」, 則 DatePicker 會以英文顯示,因為韓曆有翻譯。 不過,如果您指定日曆,且應用程式慣用語言為 「en-us」, DatePicker 仍會顯示在日文中,因為日曆沒有翻譯。

適用於

另請參閱