c# UWP resource directory DataTemplate with x:DataType not working

Paul Ryan 321 Reputation points
2024-09-12T14:45:36.5366667+00:00

HI,

using VS2022 UWP c#

I am trying to put a DataTemplate into a ResourceDictionary using a x:DataType

I get a compile error

Severity Code Description Project File Line Suppression State

Error The XAML Binary Format (XBF) generator reported syntax error '0x09C4' : Property Not Found Chiropractor C:\Users\pryan\OneDrive\Chiropractor\Chiropractor....\MUA_Common\MUA_Common\Resources\DicPageResource.xaml 6

I am trying figure out how to resolve this issue or if cannot be done

<ResourceDictionary

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

xmlns:muca="using:MUA_Common.Model.Appointments" >

<DataTemplate x:Name="Test" x:Key="AppointmentLineTemplate" x:DataType ="muca:AppointmentModel" >

   

</DataTemplate>

</ResourceDictionary>

Universal Windows Platform (UWP)
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,858 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Junjie Zhu - MSFT 17,396 Reputation points Microsoft Vendor
    2024-09-13T02:45:40.1733333+00:00

    Hi @Paul Ryan ,

    According to the official code sample, you need to add a namespace reference x:Class="YourProjectNameSpace.YourDictionaryXamlFileName" to this ResourceDictionary, and the content of ResourceDictionary cannot be empty.

    <ResourceDictionary
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    	xmlns:muca="using:MUA_Common.Model.Appointments"
        x:Class="YourProjectNameSpace.YourDictionaryXamlFileName">
    
        <DataTemplate x:Key="AppointmentLineTemplate" x:DataType ="muca:AppointmentModel" >
            <Grid>
            </Grid>
        </DataTemplate>
    </ResourceDictionary>
    
    

    Thank you.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Thank you.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.