为什么会出现此错误?无法从中加载类型

时间:2018-08-03 03:19:06

标签: c# android ios xaml xamarin

我当时在我的项目中,突然出现此错误:
Can't load types from xmlns http://schemas.microsoft.com/winfx/2006/ xaml/presentation TaskX.UWP C:\Users\M\source\repos\TaskX\TaskX\TaskX\New.xaml

这是我的完整代码:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage

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

<StackLayout>
  <Label Text="Hello World"/>
</StackLayout>

</ContentPage>

1 个答案:

答案 0 :(得分:1)

如果要重命名页面,则需要确保xaml类指向您的后备类

Xaml

<ContentPage
    x:Class="YourNameSpace.SomeAwesomeNamePage"

隐藏代码

public partial class SomeAwesomeNamePage : ContentPage