I had the exact same error message, and spent way to much time figuring it out, because of the confusing error message.
The cause of the problem was that I defined the "dataTemplate" in an ItemsControl as content:
<ItemsControl ItemsSource="{Binding SomeList}">
<Grid>
... template ...
</Grid>
</ItemsControl>
Fixed it by proparly declaring the template
<ItemsControl ItemsSource="{Binding SomeList}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
... template ...
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
It something that I have already done a hundred times, but I was completely fooled by the message and started looking in the wrong file...