I plan to equip the settings page of my Windows App SDK app with a ComboBox that contains all languages my app supports so that the user can pick whatever language is desired. Graphically, it looks as follows:
I populate the content of the ComboBox by iterating over the languages that are returned by Windows.Globalization.ApplicationLanguages.ManifestLanguages
and creating a view model for each language.
If the user then selects a language via ComboBox, I set the Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride
to the language that the user selected.
These steps work as expected. But what I fail to understand is how to initially set the selected language of the ComboBox when the user enters my settings page.
To achieve that, I would need to know what language my app is currently running with. Initially, if the user hasn't picked a language yet, the PrimaryLanguageOverride
property is simply empty. Therefore, I cannot use that property to get the language in that case. I can do so after the user picked a language, but not until that is the case.
So the question is, how do I query my application to get the actual language it is running with?