I’ve been asked on how to change the keyboard layout when the application is loaded, e.g. when your localized application is starting up you need to set the keyboard layout to Persian (Farsi).
private InputLanguage GetFarsiLanguage() { //Enumerate through InstalledInputLanguages which contains //all the keyboard layout you’ve installed in your windows. foreach (InputLanguage lang in InputLanguage.InstalledInputLanguages) { if(lang.LayoutName.ToLower() == "farsi") return lang; }
returnnull; }
publicvoidYourMethod() { InputLanguage lang = GetFarsiLanguage();
if(lang == null) thrownew NotSupportedException("Farsi Language keyboard is not installed.");
//Set the current language of the system to //the InputLanguage instance you need. InputLanguage.CurrentInputLanguage = lang; }