Set WPF webbrowser control to use IE10 mode Set WPF webbrowser control to use IE10 mode wpf wpf

Set WPF webbrowser control to use IE10 mode


If you don't want to modify the registry and you control the webpage, you can use the

<meta http-equiv="X-UA-Compatible" content="IE=10">

tag in the document's head. I believe it has to be first or immediately following <title> in order to work.


For WPF webbrowser control use IE11 mode need , for example, in the constructor of the main window, add the following code:

var pricipal = new System.Security.Principal.WindowsPrincipal(  System.Security.Principal.WindowsIdentity.GetCurrent());if(pricipal.IsInRole(System.Security.Principal.WindowsBuiltInRole.Administrator)) {    RegistryKey registrybrowser = Registry.LocalMachine.OpenSubKey        (@"Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION", true);    string myProgramName = Path.GetFileName(System.Reflection.Assembly.GetExecutingAssembly().Location);    var currentValue = registrybrowser.GetValue(myProgramName);    if (currentValue == null || (int)currentValue != 0x00002af9)        registrybrowser.SetValue(myProgramName, 0x00002af9, RegistryValueKind.DWord);}else    this.Title += " ( Первый раз запускать с правами админа )";

If you want to see WPF webbrowser control use IE11 mode in DEBUG mode when run from visual studio, you need to add in the registry all progmam "*". This can be done with the following code:

var pricipal = new System.Security.Principal.WindowsPrincipal(    System.Security.Principal.WindowsIdentity.GetCurrent());if (pricipal.IsInRole(System.Security.Principal.WindowsBuiltInRole.Administrator)) {    RegistryKey registrybrowser = Registry.LocalMachine.OpenSubKey    (@"Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION", true);    var currentValue = registrybrowser.GetValue("*");    if (currentValue == null || (int)currentValue != 0x00002af9)        registrybrowser.SetValue("*", 0x00002af9, RegistryValueKind.DWord);}else    this.Title += " ( Первый раз запускать с правами админа )";

Checked for windows 10 and visual studio 2015.

Remark: codes other versions of internet explorer, see here https://msdn.microsoft.com/en-us/library/ee330730(v=vs.85).aspx#browser_emulation