13

I'm creating a new UWP Blank App project targeting the Anniversary Build of Windows. Here's the markup of my only page (which is named MainPage.xaml by the default template):

<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>

The class BindyThing is declared like this in a CS file:

namespace App1
{
     public class BindyThing
     {
     }
}

As you can see from the markup above, I'm attempting to create a DataTemplate to render BindyThing. However, when I compile, I get the following error:

The XAML Binary Format (XBF) generator reported syntax error '0x09C4' : Property Not Found

This error disappears when I comment out the declaration of the DataTemplate. Does anyone have any insight as to why I'm getting this? All help appreciated. Thank you!

Jammer
  • 441
  • 5
  • 15

3 Answers3

11

It looks like you can't have a blank DataTemplate element in your xaml. I was able to get your example to work with the below:

<DataTemplate x:Key="MyDataTemplate" x:DataType="local:BindyThing">
    <TextBlock></TextBlock>
</DataTemplate>
Sergei Temkin
  • 126
  • 1
  • 3
  • 10
    I'm facing the same issue and my `DataTemplate` is not blank. It is defined in App.xaml though. If I simply move it to the place where it is being referenced and remove `x:Key` attribute, the same template works fine. – dotNET Sep 25 '16 at 05:32
2

(My comment in Sergei's answer proved handy for a few people, so I'm promoting it to an answer to make it more visible)

I was facing the same issue and my DataTemplate was not blank. It was defined in App.xaml though. Simply moving it to the place where it was being referenced and removing x:Key attribute made it work fine.

dotNET
  • 33,414
  • 24
  • 162
  • 251
2

I had the same problem except my datatemplate wasn't blank. I found out you can't have the data template blank and if you try to use x:Type in a resource dictionary that is merged in app.xaml it won't work either. this link explains how to x:bind in resource dictionaries instead:Resource dictionaries with {x:Bind}