0

我正在尝试熟悉 Avalonia,并将我的一个项目移植到它上面。

我在创建新窗口时遇到问题 - 我使用Tutorial中的手册,并在我的解决方案资源管理器中仅获取 .xaml.cs 文件: 在此处输入图像描述

文件 AboutView.xaml 在项目文件夹中创建,包含

<Window xmlns="https://github.com/avaloniaui"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
    x:Class="MyProjectName.Views.AboutView"
    Title="AboutView">
Welcome to Avalonia!

但未显示。AboutView.xaml.cs 包含以下代码,并显示错误:

在此处输入图像描述

我究竟做错了什么?

4

1 回答 1

3

我通过在资源管理器中切换到文件系统(或类似的东西)并找到扩展名为.csproj的文件来解决此问题。我删除了这个配置部分,问题就消失了:

<ItemGroup>
    <Page Include="Views\AdditionalWindow.xaml">
        <SubType>Designer</SubType>
    </Page>
</ItemGroup>
于 2020-10-29T20:27:02.697 回答