UWP Change keyboard language during runtime - c#

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.

Related

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#.

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

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

Touchscreen keyboard for kiosk

I wrote a simple c# windows forms application (.net, in visual studios 2012) for a mouse-controlled keyboard for use in a desktop application. Ultimately, I want to have a keyboard form that can be used on a touchscreen in a kiosk-like setting.
My question: can I expect the desktop app to work "as is" on a touchscreen? My specific concern is whether I can reasonably expect the mouse-click events to intercept touch events on the touchscreen, or whether I should a priori consider importing certain libraries and/or bind events other than "Click". I would simply test it myself but I don't have access rights now to a touchscreen device on which I can run the app.
Can I expect the desktop app to work "as is" on a touchscreen?
Yes, it's down to the hardware to translate a "touch" to a click. You can write more advanced apps which target touch screen devices specifically e.g. swiping/pinching etc. However, if yours is just a basic app with buttons it should all work the same on a touch screen.

Categories