简体   繁体   English

Avalonia - 如何创建新的 window?

[英]Avalonia - how to create new window?

I'm trying to get familiar with Avalonia, and porting one of my projects to it.我正在尝试熟悉 Avalonia,并将我的一个项目移植到它上面。

I have a problem with creating new windows - I use manual from Tutorial , and get just.xaml.cs file in my Solution Explorer:我在创建新的 windows 时遇到问题 - 我使用教程中的手册,并在我的解决方案资源管理器中获取 just.xaml.cs 文件: 在此处输入图像描述

File AboutView.xaml is created in project folder, contains文件 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!

but not shown.但未显示。 AboutView.xaml.cs contains the following code, and shows error: AboutView.xaml.cs 包含以下代码,并显示错误:

在此处输入图像描述

What am i doing wrong?我究竟做错了什么?

I fixed this by switching to the file system (or something similar) in the explorer, and finding the file with the .csproj extension.我通过在资源管理器中切换到文件系统(或类似的东西)并找到扩展名为.csproj的文件来解决此问题。 I removed this configuration section and the problem disappeared:我删除了这个配置部分,问题就消失了:

<ItemGroup>
    <Page Include="Views\AdditionalWindow.xaml">
        <SubType>Designer</SubType>
    </Page>
</ItemGroup>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM