Peter
Peter

Reputation: 679

How can I use different data templates for pivot items

I am using a Pivot control with databinding.

The ItemsSource for the pivot is bound to a collection.

The ItemTemplate is includes a listbox and that is bound to a another collection via databinding. All is working okay and everything is being populated as it should be.

What I now need to do is alter things slightly that the data displayed for the first Pivot item is different to all the others... i.e. I would like a different datatemplate for the first Pivot Item.

Upvotes: 0

Views: 781

Answers (1)

Richard Szalay
Richard Szalay

Reputation: 84734

The most common pattern I've seen used here is to create a DataTemplateSelector, which extends ContentControl and determines the template at runtime.

Windows Phone Geek have an article that takes you through what is required. Don't forget to bind Content="{Binding}", that's something that always trips me up ;)

Upvotes: 2

Related Questions