1

Using CefSharp 75.1.142, I have developed a C# Winforms application. It has a SplitContainer splitContainer1 with the top panel having a ComboBox combobox1 and with the bottom panel having ChromiumWebBrowser control.

I have Windows 7 with English and Greek keyboard layouts (default is English). During initialization, I change the app's input language to Greek and add ChromiumWebBrowser control like this:

InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(new System.Globalization.CultureInfo("el-gr"));
ChromiumWebBrowser browser = new ChromiumWebBrowser(comboBox1.SelectedValue.ToString());
this.splitContainer1.Panel2.Controls.Add(browser);

However, while input language has changed for the application, the browser control continues to have the default input for my system, which is English. If I click on the combobox, language bar of Windows 7 show Greek language, when I click on browser control, language bar shows English language.

How can I change input language for browser control, too?

Wizard
  • 2,961
  • 2
  • 13
  • 22
  • This [post](https://stackoverflow.com/a/35816248/3110834) *may* help. – Reza Aghaei Oct 27 '19 at 20:34
  • Unfortunately, it didn't work. Could it have something to do with CefSharp.BrowserSubprocess.exe or the UI thread of CefSharp? I'm changing input language for the whole app and yet CefSharp is ignoring it. – Wizard Oct 27 '19 at 20:52
  • 1
    Yes, it might be the reason, apparently it uses different process. – Reza Aghaei Oct 27 '19 at 20:53

1 Answers1

2

I solved it by using IsBrowserInitializedChanged event because according to the docs:

Event called after the underlying CEF browser instance has been created. It's important to note this event is fired on a CEF UI thread, which by default is not the same as your application UI thread.

So, I used:

browser.IsBrowserInitializedChanged += OnIsBrowserInitializedChanged;
private void OnIsBrowserInitializedChanged(object sender, EventArgs e)
{
  InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(new System.Globalization.CultureInfo("el-gr"));
}
Wizard
  • 2,961
  • 2
  • 13
  • 22