Set the content of a specific pivot table item

I wrote a Windows Phone 8.1 (WINPRT) app. It contains a Pivot where pivots are dynamically generated according to JSON.

For example, when I open the clothing category page, → Summer Wear, Winter Wear, etc. elements are dynamically generated.

Now I click the button to load more items in the GridView (ObservableCollection) and it is displayed on the currently selected PivotItem.

(MainPagePivot.SelectedItem as PivotItem).Content = StatusGridObject;

      

How do I add these elements to some other pivot element and not the selected one. For example, I am on pivotitem at index 0, how do I add data to the pivot item at index 4? Any linq query? I don't want to use MainPagePivot.SelectedItem, but some other pivot item

+3


source to share


1 answer


I think you can do something like this:

((PivotItem)MainPagePivot.Items[index]).Content = StatusGridObject;

      

Of course thanks to linq you can also use something like .Where () or .Any () on MainPagePivot.Items



example with linq:

((PivotItem)MainPagePivot.Items.First(p => p.Name == "PivotItemFour")).Content = StatusGridObject;

      

Let me know if it works!

+4


source







All Articles