GoodVibethisday
GoodVibethisday

Reputation: 21

How can i change language for CalendarDatePicker UWP?

How can i change language for this calendar into Japanese not using CalendarIndentifier.

MainPage's XAML

<Button content="Click" Click="Button_Click" />

MainPage.xaml.cs

private async void Button_Click(object sender, RoutedEventArgs e)
{
    ApplicationLanguages.PrimaryLanguageOverride = "ja-jp";    
    testDialog dialog = new testDialog();      
    await dialog.ShowAsync();
}

My calendar is in testDialog.

testDialog's xaml

<CalendarDatePicker />

CalendarDatePicker's language will not change immediately, it will change after i close the app and open

My current OS's language is: en-us

Upvotes: 2

Views: 502

Answers (1)

kennyzx
kennyzx

Reputation: 13003

From the docs:

When you set the PrimaryLanguageOverride, this is immediately reflected in the ApplicationLanguages.Languages property. However, this change may not take effect immediately on resources loaded in the app UI.

To make sure the app responds to such changes, you can listen to the QualifierValues property on a default resource context and take whatever actions may be needed to reload resources. Those requirements may vary depending on the UI framework used by the app, and it may be necessary to restart the app.

Upvotes: 1

Related Questions