“页面”类型不支持直接内容

Mat*_*evz 6 uno-platform

我从模板创建了新的 Uno Cross-Platform App 2.2。当我在代码视图中打开 Shared->MainPage.xaml 时没有打开设计器,出现下划线错误The type 'page' does not support direct content

<Page
    x:Class="App6.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:App6"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <TextBlock Text="Hello, world!" Margin="20" FontSize="30" />
    </Grid>
</Page>
Run Code Online (Sandbox Code Playgroud)

Jer*_*ban 13

这是一个 Intellisense 问题,当项目选择器(XAML 编辑器顶部的 DropDown)不在 UWP 项目上,而是在 iOS、Android 或其他平台上时,就会发生这种问题。

如果选择 UWP 项目,关闭编辑器,再重新打开,错误就会消失。

从 Visual Studio 2019 16.5 开始,该问题仍然存在,但可能会在未来版本中得到解决。