It works for me, with the WinUI2 package :
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
So, according to this documentation: winui2 it is possible to use WebView2
in UWP apps. However, when I try to add the WebView2
component I always get the same 2 errors:
1) XDG0008 The name "WebView2" does not exist in the namespace "using:Microsoft.UI.Xaml.Controls".
2) XLS0414 The type 'control:WebView2' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.
I follow the instructions exactly like the website says, yet I always get those errors. My question is, whether or nor it is currently possible to actually use WebView2
component in UWP apps or is there something I do wrong when I try to add the component to my app?
MainPage.xaml code:
<Page
x:Class="Internet_Browser.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:control="using:Microsoft.UI.Xaml.Controls"
xmlns:local="using:Internet_Browser"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
<control:WebView2 x:Name="wv2" Source="https://bing.com"/>
</Grid>
</Page>
It works for me, with the WinUI2 package :