Beispiel #1
0
        void Scroll_AnimationEnd(object source, ScrollableBase.ScrollEventArgs e)
        {
            int index = scrollable.CurrentPage;

            if (index >= 0 && index < pagination.IndicatorCount)
            {
                pagination.SelectedIndex = index;
            }
        }
Beispiel #2
0
    // There are two ways to set the current selected index using ScrollableBase event.
    void Scroll_AnimationEnd(object source, ScrollableBase.ScrollEventArgs e)
    {
        ///////////////////// 1. Using the parameter of the event /////////////////////
        // e.Position.X means the top-left position of ScrollableBase and Container.
        // So, if the page is passed once, X position becomes -360. And when the page is the second one, it's -720.
        // It can allow you to know the index of the page.

        //int index = (int)Math.Abs( e.Position.X / 360 );

        ///////////////////// 2. Using CurrentPage property of ScrollableBase /////////////////////
        // In this time, ScrollableBase variable should be global. Then, the user can get the value.

        int index = scrollable.CurrentPage;

        if (index >= 0 && index < pagination.IndicatorCount)
        {
            pagination.SelectedIndex = index;
        }
    }