4

Microsoft has recently released Edge browser which uses Chromium engine to render HTML. Is there a WinForms component which allows to embed it in a desktop application?

I'm aware of CefSharp for WinForms, just looking if there's something supported natively.

Reza Aghaei
  • 120,393
  • 18
  • 203
  • 398
Kel
  • 7,680
  • 3
  • 29
  • 39
  • 1
    [Microsoft Edge WebView2](https://learn.microsoft.com/en-us/microsoft-edge/hosting/webview2) developer preview is available for Win32 C++ on Windows 10, Windows 8.1, Windows 8, and Windows 7. In the future, it will be planned to support WebView2 on .NET, and XAML. – Reza Aghaei Jan 29 '20 at 04:11
  • If you are looking for Microsoft Edge (NOT Chromium Edge) support for Windows Forms, you may want to use [`WebViewCompatible`](https://learn.microsoft.com/en-us/windows/communitytoolkit/controls/wpf-winforms/webviewcompatible?WT.mc_id=DT-MVP-5003235). – Reza Aghaei Jan 29 '20 at 05:24
  • What is the reason for CefSharp not satisfying your needs? – Uwe Keim Jan 29 '20 at 05:28
  • 3
    Probably → *just looking if there's something supported natively.* – Reza Aghaei Jan 29 '20 at 05:29
  • I'm currently successfully using the WebView control with a .NET WinForms program. I tried WebViewCompatible but wasn't satisfied with it. I will attempt to migrate to WebView2 when it is released. – Mike Meinz Feb 23 '20 at 15:50

1 Answers1

6

WebView2

The Microsoft Edge WebView2 control enables you to host web content in your application using Microsoft Edge (Chromium) as the rendering engine.

The control is available on the following programming environments:

  • Win32 C/C++ (GA)
  • .NET Framework 4.6.2 or later
  • .NET Core 3.1 or later
  • .NET 5

Getting started with WebView2

  1. Install prerequisites on your machine:

  2. Create a Windows Forms Application.

  3. Install WebView2 NuGet package in your project.

  4. Drop an instance of the WebView2 from toolbox on your form.

  5. Set the Source property to a valid URL like: Https://bing.com and run the application.

More information

Note: WebView2 will replace the WebView control in the toolkit. WebView has already been marked as obsolete.

Reza Aghaei
  • 120,393
  • 18
  • 203
  • 398
  • it seems it is now available for .Net: https://learn.microsoft.com/en-us/microsoft-edge/webview2/?WT.mc_id=DT-MVP-5003235#getting-started – ASh Jun 23 '20 at 08:25
  • @ASh Thanks for the info, I'll check it later, however if you have already checked it, feel free to apply an edit :) – Reza Aghaei Jun 23 '20 at 08:28
  • there is definitely a github repo with samples for WinForms and WPF. I haven't tried them yet – ASh Jun 23 '20 at 08:29
  • @ASh Updated the post, however I couldn't run the example because of a null reference exception. But I assume it's stable enough as Preview. – Reza Aghaei Jun 23 '20 at 10:41
  • @RezaAghaei null reference exception is probably raised because you dont have runtime installed: https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#the-webview2-runtime – Nikola Feb 18 '22 at 16:35
  • @Nikola As far as I remember the issue was temporary, and I don't have any issue at the moment. But as you see in the post the first step is pointing out installation of prerequisites :) – Reza Aghaei Feb 18 '22 at 16:40