
If you're a WPF developer looking to bring the latest web browsing capabilities to your apps, you're in luck with WebView2 for Microsoft Edge. This powerful control allows you to embed the Microsoft Edge browser directly into your WPF applications.
WebView2 for Microsoft Edge is a significant improvement over its predecessor, offering better performance, security, and compatibility. It's designed to work seamlessly with WPF, making it a great choice for developers.
To get started with WebView2 in your WPF app, you'll need to install the Microsoft.Web.WebView2 NuGet package. This will give you access to the WebView2 control, which you can then use to create a window that displays web content.
Installation
Installation can be a bit tricky, but don't worry, I've got you covered.
To install Microsoft Edge WebView2 runtime, you can download it from the Microsoft website, https://developer.microsoft.com/en-us/microsoft-edge/webview2/#download-section, if you're installing iManage Work Desktop for Windows as a standalone application.
You don't need the Microsoft Edge browser to run the runtime.
Worth a look: Windows Azure Powershell Download
If you're using the Auto Updates channel, the runtime will be downloaded and installed separately before installing iManage Work Desktop for Windows 10.5.0.
The installation changes include installing the Microsoft Edge WebView2 SDK redistributable to the iManage Work Desktop for Windows installation folder.
To install the WebView2 SDK in Visual Studio, you can utilize the NuGet Package Manager to incorporate the package into your project.
Here are the steps to install the WebView2 SDK:
- Utilize the NuGet Package Manager in Visual Studio to incorporate the WebView2 SDK into your project.
- In the Solution Explorer, right-click on your project and choose Manage NuGet Packages.
- Within the NuGet Package Manager window, navigate to the Browse tab and look for Microsoft.Web.WebView2.
- Press on Install beside the Microsoft.Web.WebView2 package.
- Agree to the default version and proceed with the installation.
Requirements
To get started with WebView2 on Windows, you'll need to ensure you have the necessary requirements in place. You should have installed Visual Studio, and if not, you can download it from the official website: https://visualstudio.microsoft.com/downloads/.
WebView2 works with both .NET Framework and .NET Core projects, so make sure you have the appropriate version installed for your project type.
To use WebView2, Microsoft Edge WebView2 Runtime should be installed and enabled on each Smart View client machine. This is especially important if you're working with complex login sequences that require newer controls.
Here are the supported versions of WebView2:
- Smart View began supporting WebView2 in release 21.100.
- Full support for WebView2 is available in release 23.210 and later.
- WebView2 is supported only on Microsoft Windows 10 and 11.
In addition to these requirements, it's worth noting that WebView2 may not work as expected on Windows Server versions, even if it's installed and enabled. This is because Office applications don't share the WebView2 data folder, which can cause issues with functionality that relies on it.
Usage
Webview 2 Windows is designed to work seamlessly with your existing applications, allowing you to integrate web content into your desktop interface with ease.
You can use Webview 2 Windows in a variety of ways, including as a standalone application, embedded in your own application, or as a control in your own UI.
To get started with Webview 2 Windows, you'll need to install the necessary libraries and frameworks, such as the Chromium Embedded Framework, which provides the core functionality for rendering web content.
Discover more: Windows Azure Application
Using Microsoft Edge
Microsoft Edge is a powerful tool that can be used in various ways to enhance your applications. Hybrid applications can be developed using WebView2 in Microsoft Edge, allowing you to combine the best of both web and native features.
To use WebView2 in Microsoft Edge, you need to have the Microsoft Edge WebView2 Runtime installed and enabled on each client machine. This is particularly important for Oracle Smart View for Office, which uses WebView2 to process complex login sequences.
WebView2 is supported only on Microsoft Windows 10 and 11, but it can be installed on Windows Server versions as well. However, there may be instances where you need to log in again to different Office applications, such as Excel and Word, due to the shared data folder issue.
Administrators can enable or disable WebView2 by editing the Smart View properties.xml file and distributing it to users. The configuration settings for enabling and disabling WebView2 are as follows:
WebView2 offers events and methods to interact with the displayed web content, allowing you to include additional features such as navigation buttons in your application.
Step 3: Add Control
Now that you have the WebView2 SDK installed, it's time to add the WebView2 control to your application's user interface. You can easily find it in the toolbox window of Visual Studio.

Locate the WebView2 control in the toolbox window, which is typically positioned on the right side. It's usually found under the Common or Experimental section, depending on the version of Visual Studio you're using.
Drag and drop the WebView2 control onto the design surface of your main form, which is the window where your application will be shown.
Implementation
To implement WebView2 in your Windows application, you'll need to follow these steps.
First, install the WebView2 SDK by right-clicking on your project in the Solution Explorer and selecting Manage NuGet Packages. Then, search for and install the Microsoft.Web.WebView2 package.
To create a simple window with a WebView2 control, set the Source property to the URL of the website you want to load. For example, you can set it to "https://www.microsoft.com/en-us/" to load the Microsoft website.
You can also use the code-behind file to manage events from the WebView2 control or engage with the web content that has been loaded. The code-behind file is currently blank, but you can utilize it to add functionality to your application.
Here's a quick rundown of the steps to build and run your application:
- Save your project (Ctrl+Shift+S).
- Press F5 to run the application.
- The window will open and display the website within the WebView2 control.
Requirements for Implementation

Before you start implementing, make sure you have the necessary requirements in place.
To begin with, you'll need to have Visual Studio installed on your computer. If you haven't already, you can download it from the official website: https://visualstudio.microsoft.com/downloads/.
Ensure you have the correct version of .NET Framework or .NET Core installed for your project type, as WebView2 works with both.
Here are the key requirements to keep in mind:
- Visual Studio installation
- .NET Framework or .NET Core version
Create a Simple WPF App
To create a simple WPF app, start by installing the WebView2 SDK. Right-click on your project in the Solution Explorer and select Manage NuGet Packages. Search for and install the Microsoft.Web.WebView2 package.
The code for a simple window with a WebView2 control can be created in just a few steps. This code creates a simple window that contains a WebView2 control called webView. The WebView2 control's Source property is set to "https://www.microsoft.com/en-us/" to indicate the website to load first.

You can manage events from the WebView2 control or engage with the web content that has been loaded in the code-behind file. The code-behind file is currently blank, but it can be utilized to do so.
To build and run your project, save your project (Ctrl+Shift+S) and press F5 to run the application. The window will open and display the Microsoft website within the WebView2 control.
Take a look at this: Run 2 Html5
Handling
Handling navigation in a WebView2 Windows application is a crucial aspect of user experience. You can include navigation buttons such as back, forward, and refresh.
The WebView2 API offers methods and events to interact with the displayed web content. This allows you to customize the navigation experience for your users.
To implement navigation, you can use the provided events and methods. For example, you can use the navigation buttons to send commands to the web content.
WebView2 also provides a way to handle navigation through its events and methods. This enables you to create a seamless navigation experience for your users.
Build and Run
To build and run your WebView2 application, you're ready to develop and test once you've included the WebView2 control and added any extra features. Remember to save your project by pressing Ctrl+Shift+S.
Pressing F5 will start debugging and run the application. The WebView2 control will appear blank initially.
To ensure your application is set up correctly, make sure you've followed the necessary steps to include the WebView2 control and add any extra features.
SDK and Tools
To get started with WebView2 Windows, you'll need to install the WebView2 SDK. This is a crucial step that will allow you to incorporate WebView2 into your project.
In Visual Studio, you can utilize the NuGet Package Manager to install the WebView2 SDK. This is a straightforward process that can be completed in a few steps.
First, right-click on your project in the Solution Explorer and choose Manage NuGet Packages. This will open the NuGet Package Manager window.
Navigate to the Browse tab and look for Microsoft.Web.WebView2. Once you've found it, press the Install button beside the package.
The NuGet Package Manager will then prompt you to agree to the default version and proceed with the installation.
Additional reading: Windows Azure Traffic Manager
Frequently Asked Questions
What is Microsoft WebViewer 2?
Microsoft Edge WebView2 is a control that enables native apps to embed web technologies like HTML, CSS, and JavaScript. It allows developers to bring web experiences into their apps seamlessly.
What is web view 2?
WebView2 is a technology that allows app developers to easily embed HTML content in their apps, leveraging the rendering capabilities of Microsoft Edge. It simplifies the process of displaying web content within native apps.
Do I need Microsoft Edge WebView 2 Runtime?
To use Office features that rely on WebView2, you need Microsoft Edge WebView2 Runtime installed on your device. If it's not installed, you won't be able to use those features.
Featured Images: pexels.com


