コード例 #1
0
 /// <summary>
 /// Handles the touch.
 /// </summary>
 /// <returns>The touch.</returns>
 /// <param name="sender">Sender.</param>
 /// <param name="e">E.</param>
 public void HandleTouch(object sender, EventArgs e)
 {
     if (SelectedCommand != null && !_animating)
     {
         var cell = CarouselScroll.GetSelectedItem(SelectedIndex);
         SelectedCommand.Execute(cell);
     }
 }
コード例 #2
0
        /// <summary>
        /// Handles the swipe left.
        /// </summary>
        /// <returns>The swipe left.</returns>
        /// <param name="sender">Sender.</param>
        /// <param name="e">E.</param>
        public async void HandleSwipeLeft(object sender, EventArgs e)
        {
            if (((CarouselScroll.ScrollX + CarouselScroll.Width) < (CarouselScroll.Content.Width - CarouselScroll.Width)) && !_animating)
            {
                _animating = true;

                SelectedIndex++;
                await CarouselScroll.ScrollToAsync(CarouselScroll.ScrollX + Width + 20, 0, true);

                _animating = false;
            }
        }
コード例 #3
0
        /// <summary>
        /// Handles the swipe right.
        /// </summary>
        /// <returns>The swipe right.</returns>
        /// <param name="sender">Sender.</param>
        /// <param name="e">E.</param>
        public async void HandleSwipeRight(object sender, EventArgs e)
        {
            if (CarouselScroll.ScrollX > 0 && !_animating)
            {
                _animating = true;

                SelectedIndex--;
                await CarouselScroll.ScrollToAsync(CarouselScroll.ScrollX - Width - 20, 0, true);

                _animating = false;
            }
        }