我正在创建一个针对Windows周年更新版本的UWP空白应用程序项目。以下是我的唯一页面(默认模板命名为MainPage.xaml)的标记:
<Page
x:Class="App1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App1"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.Resources>
<DataTemplate x:Key="MyDataTemplate" x:DataType="local:BindyThing">
</DataTemplate>
</Grid.Resources>
</Grid>
在CS文件中,BindyThing类的声明如下:
namespace App1
{
public class BindyThing
{
}
}
从上面的标记中可以看出,我正在尝试创建一个DataTemplate来渲染BindyThing。然而,在编译时,我遇到了以下错误:
XAML二进制格式(XBF)生成器报告语法错误“0x09C4”:找不到属性
当我将DataTemplate的声明注释掉时,这个错误就消失了。有没有人知道我为什么会遇到这个问题?感谢大家的帮助。谢谢!
DataTemplate
并不是空白的。它在 App.xaml 中被定义。如果我将其简单地移动到引用它的位置并删除x:Key
属性,同一个模板就可以正常工作。 - dotNET