locked
Auto scroll the Flipview inside of HubSection in windows store app

    Question

  • I am trying to auto flip the item of FlipView Items in windows store app. I have tried the following code.

     public MainPage()
            {
                InitializeComponent();
    
                //Configure the timer
                _timer = new DispatcherTimer
                {
                    //Set the interval between ticks (in this case 2 seconds to see it working)
                    Interval = TimeSpan.FromSeconds(2)
                };
    
                //Change what's displayed when the timer ticks
                _timer.Tick += ChangeImage;
                //Start the timer
                _timer.Start();
            }
    
            /// <summary>
            /// Changes the image when the timer ticks
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="o"></param>
            private void ChangeImage(object sender, object o)
            {
                //Get the number of items in the flip view
                var totalItems = TheFlipView.Items.Count;
                //Figure out the new item's index (the current index plus one, if the next item would be out of range, go back to zero)
                var newItemIndex = (TheFlipView.SelectedIndex + 1) % totalItems;
                //Set the displayed item's index on the flip view
                TheFlipView.SelectedIndex = newItemIndex;
            }

    But i am not able to access the FlipView from .cs file because of the FlipView defined inside of HubSection. How can i solve this? Is there any way of accessing the FlipView or any other way of auto flip the item of FlipView.


    Sumit Tuladhar

    Wednesday, July 30, 2014 10:28 AM

Answers

All replies