if (LanguageComboBox.SelectedIndex == 0)
{
var culture = new CultureInfo("en-US");
Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = culture.Name;
CultureInfo.DefaultThreadCurrentCulture = culture;
CultureInfo.DefaultThreadCurrentUICulture = culture;
(Window.Current.Content as Frame).FlowDirection = Windows.UI.Xaml.FlowDirection.LeftToRight;
var loader = new Windows.ApplicationModel.Resources.ResourceLoader();
HeadingTextBlock.Text = loader.GetString("Setting");
}
else if (LanguageComboBox.SelectedIndex == 1)
{
var culture = new CultureInfo("ar-SA");
Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = culture.Name;
CultureInfo.DefaultThreadCurrentCulture = culture;
CultureInfo.DefaultThreadCurrentUICulture = culture;
(Window.Current.Content as Frame).FlowDirection = Windows.UI.Xaml.FlowDirection.RightToLeft;
var loader = new Windows.ApplicationModel.Resources.ResourceLoader();
HeadingTextBlock.Text = loader.GetString("Setting");
}
这是我在应用程序内的设置页面中使用的代码。设置页面后,我还设置了flow =从右到左,并在代码中手动更改标题。
问题:问题是,在设置语言并返回后,每个页面都更改了语言,但我的主屏幕仍然显示英语,除非我完全终止应用程序并再次打开它然后它在主屏幕上显示阿拉伯语。
问如果你不明白这个问题。