private void unbindingSwipeItem(DependencyObject element)
        {
            SwipeableListViewItem listViewItem = element as SwipeableListViewItem;

            if (listViewItem != null)
            {
                listViewItem.LeftSwiped  -= ListViewItem_LeftSwiped;
                listViewItem.RightSwiped -= ListViewItem_RightSwiped;
            }
        }
Ejemplo n.º 2
0
        private void ListViewItem_ManipulationCompleted(object sender, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs e)
        {
            SwipeableListViewItem listViewItem = sender as SwipeableListViewItem;

            if (listViewItem != null)
            {
                listViewItem.CheckSwipeStatus();
                listViewItem.HideLeftContentPresenter();
                listViewItem.HideRightContentPresenter();
            }
        }
        protected override DependencyObject GetContainerForItemOverride()
        {
            SwipeableListViewItem ListViewItem = new SwipeableListViewItem()
            {
                LeftSwipeContent          = LeftSwipeContent,
                LeftSwipeContentTemplate  = LeftSwipeContentTemplate,
                RightSwipeContent         = RightSwipeContent,
                RightSwipeContentTemplate = RightSwipeContentTemplate
            };

            return(ListViewItem);
        }
Ejemplo n.º 4
0
        private void ListViewItem_ManipulationDelta(object sender, Windows.UI.Xaml.Input.ManipulationDeltaRoutedEventArgs e)
        {
            SwipeableListViewItem listViewItem = sender as SwipeableListViewItem;

            if (listViewItem != null)
            {
                double listViewItemTotalWidth        = listViewItem.ActualWidth;
                var    movementPercentageDenominator = this.SwipeTranslateXDenominator;

                double movementY          = Math.Abs(e.Cumulative.Translation.Y);
                double movementX          = e.Cumulative.Translation.X;
                double movementPercentage = Math.Min(1.0, Math.Abs(movementX) / movementPercentageDenominator);

                Debug.WriteLine("movement Y: " + movementY.ToString());

                if (e.IsInertial == false)
                {
                    if (movementX >= validTranslateXLimit)
                    {
                        SetVisualState(SwipeableListViewItemMode.RightSwipeMode);
                        HideLeftContentPresenter();
                        SetRightContentPresenterOpacity(movementPercentage);
                        e.Handled = true;
                    }
                    else if (movementX <= -(validTranslateXLimit))
                    {
                        SetVisualState(SwipeableListViewItemMode.LeftSwipeMode);
                        HideRightContentPresenter();
                        SetLeftContentPresenterOpacity(movementPercentage);
                        e.Handled = true;
                    }
                    else
                    {
                        SetVisualState(SwipeableListViewItemMode.NoSwipe);
                        HideLeftContentPresenter();
                        HideRightContentPresenter();
                    }
                }
            }
        }
        protected override DependencyObject GetContainerForItemOverride()
        {
            SwipeableListViewItem ListViewItem = new SwipeableListViewItem()
            {
                LeftSwipeContent = LeftSwipeContent,
                LeftSwipeContentTemplate = LeftSwipeContentTemplate,
                RightSwipeContent = RightSwipeContent,
                RightSwipeContentTemplate = RightSwipeContentTemplate
            };

            return ListViewItem;
        }