[英]XAML class does not exist in namespace
我得到一个错误,说新闻类在命名空间中不存在。
尝试了在线提供的许多解决方案,例如重建等,但似乎没有任何效果。 任何帮助将不胜感激。
这页纸
<Page
x:Class="KS2Buddy.Home"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:KS2Buddy"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:data="using:KS2Buddy">
<Page.Resources>
<DataTemplate x:DataType="data:News"
x:Key="NewsItemTemplate">
</DataTemplate>
</Page.Resources>
</Page>
班级
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace KS2Buddy
{
class News
{
public string Title { get; set; }
public string Image { get; set; }
public string Text { get; set; }
}
}
如果您使用的是WPF,请尝试替换
xmlns:data="using:KS2Buddy"
通过
xmlns:data="clr-namespace:KS2Buddy"
这个答案不针对UWP。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.