Reputation: 2642
I am creating an RSS reader and would like to create PivotItem
s for RSS the user has.
I know that I'll be passing in the number of items into the PivotView so I can create the number of items upon creation.
Does anyone know how I would go about this programmatically?
Upvotes: 1
Views: 1635
Reputation: 1580
The best way would be to use the MVVM pattern.
You could create a view model class for the subscriptions and add them to an ObservableCollection. You then just need to bind the Pivots ItemsSource property to the collection:
<controls:Pivot ItemsSource="{Binding Path=Subscriptions}">
<controls:Pivot.ItemTemplate>
<DataTemplate>
<controls:PivotItem Header="{Binding Path=DisplayName}">
<Listbox ItemsSource="{Binding Path=Items}">
...
...
</ListBox>
</controls:PivotItem>
</DataTemplate>
</controls:Pivot.ItemTemplate>
</controls:Pivot>
Upvotes: 3