xsharp.eu • Internet Explorer Control Replacement Webview2
Page 1 of 2

Internet Explorer Control Replacement Webview2

Posted: Sat Mar 06, 2021 4:01 pm
by ArneOrtlinghaus
It seems that Microsoft is now forcing a good replacement for the Internet Explorer Control, that should be useable with Win32/Winforms/WPF and should be installable on all computers Windows 7/Server 2012 or newer:

https://docs.microsoft.com/en-us/microsoft-edge/webview2/

Internet Explorer Control Replacement Webview2

Posted: Sat Mar 06, 2021 4:18 pm
by wriedmann
Hi Arne,
I have played with it both in the WPF and the Windows Forms version and it looks really, really good!.
WebViewWPF.png
WebViewWPF.png (106 KiB) Viewed 672 times
Wolfgang

Internet Explorer Control Replacement Webview2

Posted: Sat Mar 06, 2021 6:02 pm
by FFF
Hi Wolfgang,
would you kindly drop the "Plays" to Downloads? Followed Arne's link, shuddered to read about again a "new" UI from which i never had heard ;-) - and started to wonder, where i might get the control and add it to Xide, being a dinosaur...

Internet Explorer Control Replacement Webview2

Posted: Sat Mar 06, 2021 7:21 pm
by wriedmann
Hi Karl,
I will post a sample tomorrow morning.
But you need to have the "new" Chromium based Edge installed - in fact the control is using that, and therefore it is Windows Update to keep it updated.
Wolfgang

Internet Explorer Control Replacement Webview2

Posted: Sun Mar 07, 2021 1:35 pm
by wriedmann
Hi Karl,
let me explain what I have done:
- install the runtime on your machine: https://developer.microsoft.com/en-us/m ... ad-section
- create a new project in Visual Studio like instructed in the Microsoft documentation: https://docs.microsoft.com/en-us/micros ... tarted/wpf or https://docs.microsoft.com/en-us/micros ... d/winforms
- look in the Packages subfolder of the project: you will find a Microsoft.Web.WebView2.1.0.790-prerelease.nupkg file. Copy that in some other location, rename it to .zip and unzip it. You will find a few files in the structure you will need as dependencies: Microsoft.Web.WebView2.Core.dll, Microsoft.Web.WebView2.Wpf.dll, Microsoft.Web.WebView2.WinForms.dll
- build your own application in XIDE adding using Microsoft.Web.WebView2.Wpf (for WPF)
- try to run it - and, surprise, it will not work.
- try to copy the running MS sample to your bin folder - and it will not run.
- you have to copy the folder structure "runtimes" to your bin folder - and it will work.

Please find attached a zip file that contains both the source and a running WPF sample.
WPFWebView2.zip
(311.85 KiB) Downloaded 88 times
Wolfgang

Internet Explorer Control Replacement Webview2

Posted: Sun Mar 07, 2021 2:18 pm
by FFF
Wolfgang,
sound's intimidating ;)
Anyway: I found, i have Edge installed here. Do i get you right, that it should suffice to start your exe from your zip to get the control shown? Mine does not - form opens, canvas empty, OK button reacts...
Built a new proj in Xide, imported the aef, corrected the referenced dlls, compiles, runs - result as above...

What do i wrong - or is it imperative to first install the runtime from your link?
TIA!

Internet Explorer Control Replacement Webview2

Posted: Sun Mar 07, 2021 2:24 pm
by wriedmann
Hi Karl,
first of all: you need the "new" Chromium based Edge - the one with the new logo, not the old one with the logo like Internet Explorer.
And then probably you need the WebView2 runtime from step 1.

And yes, this configuration should run your current Edge installation.
Windows 10 is updated regularly to the newest edge, and on most W10 systems the old, Microsoft born Edge, should not be available anymore, but for your Windows 8 I don't know.

Wolfgang

Internet Explorer Control Replacement Webview2

Posted: Sun Mar 07, 2021 2:29 pm
by wriedmann
Hi Karl,
I have now tried to copy my zip file a non- development Windows 10 machine, and executing the executable. It runs, but don't shows the content.
After installing the WebView2 runtime it worked showing the web page.
Wolfgang

Internet Explorer Control Replacement Webview2

Posted: Sun Mar 07, 2021 2:39 pm
by FFF
Ok - looked for Edge, indeed it's the new one ;) - never had opened it. After that step nothing changed, tried the runtime install next. Gosh, 95MB - and no, that's NOT the runtime, only the installer :sick:
And - success! Thank you!

Internet Explorer Control Replacement Webview2

Posted: Sun Mar 07, 2021 3:07 pm
by wriedmann
Hi Karl,
if you ever have looked at the distributable Chrome: that adds at least 200 MB of binary files to your executables, and you have to keep them uptodate yourself. And as I have heard it is very hard to implement.
But the WebView2 is a Prerelease, maybe the change something.
And I have to try it in a VO application, should also work.
Wolfgang