开发者

Databound List to Pivot

I have an object which has a List in it's properties, I would like each item in that list to appear on it's own pag开发者_如何学JAVAe in the pivot.

Is a list a valid object to do this with, and how do I start?

Do I have to implement an interface in the object or do something in the pivot page code to implement cycling through the list items?


You can set the ItemSource of the Pivot control, and then change it's ItemTemplate to customize the view.

However, I would advice against it, if you have more than 7 items in the list, since this is the de-facto recommended maximum of pivot items.

Example:

<controls:Pivot ItemsSource="{Binding Items}">
   <control:Pivot.HeaderrTemplate>
       <DataTemplate>
           <!-- the pivot header -->
           <TextBlock Text="{Binding HeaderProperty}" />
       </DataTemplate>
   <control:Pivot.HeaderTemplate>
   <control:Pivot.ItemTemplate>
       <DataTemplate>
           <Grid>
               <!-- your template here -->
           </Grid>
       </DataTemplate>
   <control:Pivot.ItemTemplate>
</controls>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜