DataTemplate and PhoneApplicationPage.Resources Gotcha

When building an interface for a windows phone 7 mobile app you may want to use what are called DataTemplates to build your UI in chunks. Something like a list of accounts, you might want to create a DataTemplate to represent the singular Account within in the UI and bind it to a single ‘Account’ Model. In most fo the examples I found online about this they all displayed the DataTemplate XAML but never in context. Well it turns out you can’t just add those anywhere.

DataTemplate is expected to live into a tag named PhoneApplicationPage.Resources. which lives inside your top level PhoneApplicationPage XAML tag.

So it should look like this:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s