Search code examples
wpfinput-language

Change InputLanguage doen't work WPF


I've problem with OSK in WPF. I change the InputLanauage by InputLanguageManager like this:

InputLanguageManager.SetInputLanguage(_targetKeyboardWindow, CultureInfo.CreateSpecificCulture("ru"));

But it doesn't work. I need to change the actual view of my application (by click back button) and then my changes in InputLanguageManager starts to work. But when I tried to change View from code-behind after I change input language - it does not work.

Moreover, in debugger I can see that after changing language, the current language is still default (previous)

Any idea?


Solution

  • Ok, the solution is trivial .

    Instead of:

    InputLanguageManager.SetInputLanguage(_targetKeyboardWindow, CultureInfo.CreateSpecificCulture("ru"));
    

    use:

    InputLanguageManager.Current.CurrentInputLanguage = new CultureInfo("ru");
    

    Best regards.