How to change the language settings in C# Metro App during runtime? - c#

I am developing an Win8 Metro App in C# XAML, which has all the items and their description in English language. But how can I change the language in during runtime, say from English to Spanish or Portugese, by selecting it from a list of available langauges?
I can see that MSDN offeres allowable languages to be used in order to localize the strings but not sure how to integrate them into the App.
Should I just add ApplicationLanguages.PrimaryLanguageOverride to my App.xaml.cs? Or how should the code work?
Any suggestions are most welcome.
Thank you in Advance..!

Changing the language, while an App is running, is not supported for Store Apps. The user has to change his Windows language preferences, logout and relogin to his account for changes to take effect thus forcing all Apps to shutdown. I would recommend leaving it as is, meaning one language at a time. Why would you need to do that for a published Store App anyways?
That said, here's an explanation and possible solution/workaround http://timheuer.com/blog/archive/2013/03/26/howto-refresh-languages-winrt-xaml-windows-store.aspx

Related

UWP Change keyboard language during runtime

Is there a way to change the language that Windows is using from a UWP app during runtime?
The app I am working on will be used in a kiosk environment and will be used by people with different languages. So the user needs to be able to change the language within the app, that will not only change the text displayed within the app, but also the input language on the Windows touch keyboard.
In WPF, you could simply change the CurrentInputLanguage property on the InputLanguageManager but there doesn't seem to be an alternative in UWP.
I know I can listen to the CoreTextServicesManager.InputLanguageChanged event when the input language is changed in Windows, but can't find anywhere to change it from the app.
Thanks
For now, there's no build-in API for you to change the input language at runtime in UWP app. There's a Language.TrySetInputMethodLanguageTag(String) Method, but it only supports on IOT device. So, if the device has installed other languages, you could tell them to press window+space on screen keyboard to switch input language.
In addition, you could submit a "Feature Request" to WPDev UserVoice.

Put the calculator on TopMost C# [duplicate]

I'm developing a Windows 10 Universal app (UWP).
Is it possible to set application as TopMost (always on top)? Like WPF or Winforms (TopMost property).
Thanks
A feature called CompactOverlay mode was added in the Creators Update that supports this type of functionality. When an app window enters compact overlay mode it’ll be shown above other windows so it won’t get blocked. This allows users to continue to keep an eye on your app's content even when they are working with something else. The canonical example of an app taking advantage of this feature is a media player or a video chat app.
A blog post describing the feature can be found here
https://blogs.msdn.microsoft.com/universal-windows-app-model/2017/02/11/compactoverlay-mode-aka-picture-in-picture/
Short answer is no, there is no way as of today to make the application modal.
There is a petition going around asking for this functionality, which was requested last December but given the amount of votes it got (35 at the time this answer was written), it doesn't look like it will be taken into consideration anytime soon.
As mentioned in the comments, this functionality would be PC only so even if it was added, my assumption would be that it wouldn't work outside of the PC mode (so no tablet, mobile or surface family device support).
It's not possible UWP apps have some restrictions compared with WPF of Win32 apps(classic apps).
With uwp apps you need enable some capabilities to do something special in your app as you can see in the link uwp apps need ask for permission or they can't access or modify files directly.
https://msdn.microsoft.com/en-us/library/windows/apps/mt270968.aspx
Best Regards

C# Windows Universal 10 TopMost Window

I'm developing a Windows 10 Universal app (UWP).
Is it possible to set application as TopMost (always on top)? Like WPF or Winforms (TopMost property).
Thanks
A feature called CompactOverlay mode was added in the Creators Update that supports this type of functionality. When an app window enters compact overlay mode it’ll be shown above other windows so it won’t get blocked. This allows users to continue to keep an eye on your app's content even when they are working with something else. The canonical example of an app taking advantage of this feature is a media player or a video chat app.
A blog post describing the feature can be found here
https://blogs.msdn.microsoft.com/universal-windows-app-model/2017/02/11/compactoverlay-mode-aka-picture-in-picture/
Short answer is no, there is no way as of today to make the application modal.
There is a petition going around asking for this functionality, which was requested last December but given the amount of votes it got (35 at the time this answer was written), it doesn't look like it will be taken into consideration anytime soon.
As mentioned in the comments, this functionality would be PC only so even if it was added, my assumption would be that it wouldn't work outside of the PC mode (so no tablet, mobile or surface family device support).
It's not possible UWP apps have some restrictions compared with WPF of Win32 apps(classic apps).
With uwp apps you need enable some capabilities to do something special in your app as you can see in the link uwp apps need ask for permission or they can't access or modify files directly.
https://msdn.microsoft.com/en-us/library/windows/apps/mt270968.aspx
Best Regards

How can I detect the device culture settings in a Windows Store App?

I have C# code for as Windows Store app that returns the app language information. If my app is configured to support "fr" and the device is set to that language, then the app determines that the app language information is "fr".
But if the app is not configured to support "es" and the device is set to that particular language, "es", I can not find a way to detect the device settings. I only get the default app language.
I believe that it is not possible to get the device information, only to get the information that the device passes on to the app about what language to use. But I need to ask this to be sure, since my project depends a lot on the device and app language settings.
To be blunt, I want to write the app to support only English but be able to tell the user that their device is configured for French, or Spanish, etc.... Is there a trick that can make this work?
Here is the code that tells me selected language code that the app can see. Note that this will not tell me the device settings if the device language is not supported by the app:
using System.Globalization;
...
CultureInfo ci = CultureInfo.CurrentUICulture;
Data.Add( "language", ci.TwoLetterISOLanguageName ); //My own code that adds the two letter code special data object
I found an answer in this thread:
How to get actual language in a WinRT app?
Using Windows.System.UserProfile.GlobalizationPreferences.Languages[0] will give me the language setting that the user sets in the Metro-style PC settings under Time and Language. This selection does not appear to change the Windows operating system display language, which is what I really want. But this does appear to change automatically when the OS display language is changed, so it is probably the proper feature to use for this purpose.
That other thread was about the Windows Phone, but this works in my Windows 8 Store app in C#.

Developing a custom keyboard (like Swype) for Windows Phone 7.1 Mango

Having recently bought a Windows Phone I can say the one feature I sorely miss from my Android phone is Swype. This was a custom keyboard where you trace your finger over the keyboard to create words. Its very fast and basically I think its awesome.
Anyway! There is no Swype on WP7... The reason for this I hear is because it is impossible to change the keyboard programmatically in Windows phone. I would like to know from the community if things have changed or are likely to change in this area, or if there are any workarounds to programmatically inject a custom keyboard into the UI to allow input with any text field.
Disclosure - if it becomes possible I would like to develop a swype like app, however it would likely be because I miss it so much rather than as a commercial project!
Best regards,
There is no way to officially create a new keyboard that functions outside of your app. So, if you plan to release this in the marketplace, then it's not currently possible. You might be able to create a homebrew app that does this, but I don't think it would be very easy to replace the standard keyboard system wide. Of course, even if you did manage the homebrew version, it definitely wouldn't be allowed on the Marketplace.
You're limited by what Microsoft allows you to alter and they don't allow you to alter the keyboard. Furthermore Swype is a patented and very advanced technology that would be a humongous project for a single developer to work one. It's a good idea as lots of people like Swype but WP7 isn't Android.

Categories