C# 命名空间中不存在XAML类
我收到一个错误,说名称空间中不存在News类 尝试了许多在线解决方案,如重建等,但似乎没有任何效果。如蒙协助,将不胜感激 页面C# 命名空间中不存在XAML类,c#,xaml,C#,Xaml,我收到一个错误,说名称空间中不存在News类 尝试了许多在线解决方案,如重建等,但似乎没有任何效果。如蒙协助,将不胜感激 页面 <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="usi
<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>
如果您正在使用WPF,请尝试替换
xmlns:data="using:KS2Buddy"
借
此答案并非针对UWP。也许您需要将其公开?我已经尝试过,但仍然存在相同的错误。请指定项目类型(UWP或…)。它看起来是非复制的。可能是对的,UWP支持“using:…”语法,而不是常规WPF。我刚刚意识到,WPF标签是由其他人编辑的,所以很可能原来的问题是关于UWP。。。只有作者可以澄清。对,我认为x:DataType使其成为UWP。删除了WPF标记。
xmlns:data="using:KS2Buddy"
xmlns:data="clr-namespace:KS2Buddy"