Internet Explorer Control Replacement Webview2

This forum is meant for anything you would like to share with other visitors
User avatar
ArneOrtlinghaus
Posts: 412
Joined: Tue Nov 10, 2015 7:48 am
Location: Italy

Internet Explorer Control Replacement Webview2

Post 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/
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Internet Explorer Control Replacement Webview2

Post 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 691 times
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
FFF
Posts: 1580
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Internet Explorer Control Replacement Webview2

Post 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...
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Internet Explorer Control Replacement Webview2

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Internet Explorer Control Replacement Webview2

Post 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 89 times
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
FFF
Posts: 1580
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Internet Explorer Control Replacement Webview2

Post 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!
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Internet Explorer Control Replacement Webview2

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Internet Explorer Control Replacement Webview2

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
FFF
Posts: 1580
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Internet Explorer Control Replacement Webview2

Post 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!
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Internet Explorer Control Replacement Webview2

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Post Reply