Reputation: 13
i am trying to add and remove a pivot item at runtime but it does not cause the layout to repaint itself so the removed pivot item still shows. If i add or remove a pivot item in the method OnNavigatedTo, it works. But i need this when the page is already "there", not in OnNavigatedTo. Any suggestions?
Best Yimei
Upvotes: 0
Views: 1457
Reputation: 3294
I have managed to Add and Remove Pivot Items dynamically using the following code :-
private void AddItem_Click(object sender, RoutedEventArgs e)
{
MyPivot.Items.Add(new PivotItem() { Header = "New Item" });
}
private void RemoveItem_Click(object sender, RoutedEventArgs e)
{
MyPivot.Items.RemoveAt(MyPivot.Items.Count - 1);
}
How are you adding the new Pivot Items?
Thanks
Paul Diston
Upvotes: 2