WinUI 3.0 - 为什么 UWP 项目要求用于 WebView2 的 MS Edge for Business [英] WinUI 3.0 - Why UWP project is asking for MS Edge for Business for WebView2

查看:226
本文介绍了WinUI 3.0 - 为什么 UWP 项目要求用于 WebView2 的 MS Edge for Business的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在带有 WinUI 3.0UWP 项目中使用 WebView2 控件并运行应用程序时,WebView2 中的网页代码>控件不显示.相反,该应用会显示以下消息,将我带到

解决方案

ForWinUI 3.0 Desktop"它现在是 WebView2 的支持平台,请查看此站点以了解详细信息:https://docs.microsoft.com/en-us/microsoft-edge/webview2/gettingstarted/winui.

如果您计划将 WinUI 3.0 应用程序发布为 UWP 应用程序,那么可能会有一些限制,坦率地说,我不确定该组合.

When I use WebView2 control in a UWP project with WinUI 3.0 and run the app, the webpage inside WebView2 control is not displayed. Instead, the app displays the following message that takes me to Microsoft Edge for Business download page:

a suitable version of Microsoft edge was not detected. Please install the latest beta channel build from here

Question: Why it's asking for Microsoft Edge for Business? I already have the latest version of MS Edge Canary Channel and the latest release version MS Edge installed on my Windows 10 - Pro. I don't want to install too many versions.

MainPage.xaml:

<Page
  x:Class="UWP_WinUI.MainPage"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:local="using:UWP_WinUI"
  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>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Button x:Name="myButton" Click="myButton_Click">Click Me</Button>
        <WebView2 x:Name="wvTest" Grid.Row="1" Source="https://www.bing.com/"/>
    </Grid>
</Page>

Display of the app

The webpage is supposed to display in the WebVeiw2 below the button control. But instead, the message (shown below) is displayed:

解决方案

For "WinUI 3.0 Desktop" it is now a supported platform of WebView2, check out this site for details: https://docs.microsoft.com/en-us/microsoft-edge/webview2/gettingstarted/winui.

If you plan to ship your WinUI 3.0 app is a UWP app there might be some limitations though, frankly I am no sure on that combo.

这篇关于WinUI 3.0 - 为什么 UWP 项目要求用于 WebView2 的 MS Edge for Business的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆