question

AndrewBryant-2569 avatar image
0 Votes"
AndrewBryant-2569 asked ·

Count PivotItems

I am writing a local app to be used as a wallboard/dashboard tool. The idea is to loop through various WebViews of SSRS reports.

A counter is operated via a DespatcherTimer and each time a set interval is hit, the SelectedIndex on the pivot is incremented (BigPivot.SelectedIndex++) but obviously this fails when it hits the end of the PivotItems list.

Other tools have a SelectedIndexCollection.Count property that can be used to set th upper limit of the loop. What would I need to do to do the same with a Pivot?

windows-uwpwindows-uwp-xaml
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

FayWang-MSFT avatar image
0 Votes"
FayWang-MSFT answered ·

Hello,​

Welcome to our Microsoft Q&A platform!

As you said, you need to set the upper limit of the loop to avoid the SelectedIndex exceeding its maximum number. So You can try to use BigPivot.Items.Count property to set.

 private int index = 0;
 private void dispatcherTimer_Tick(object sender, object e)
 {
         index++;
         if (index < BigPivot.Items.Count) 
         {
                 BigPivot.SelectedIndex++;
         }
         else { 
                 // do something
         }
                
 }

Thanks.

· 2 · Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks. Just moving to UWP and C# from VB and I guess I expected Microsoft to be consisting in assigning the count to the Collection :)

0 Votes 0 · ·

About this feature request, you can go to start menu -> feedback hub to feedback.

0 Votes 0 · ·