Esempio n. 1
0
        void IDragDropElement.DragOver(DragContext context)
        {
            if (context == null)
            {
                return;
            }

            var data = context.PayloadData as ReorderItemsDragOperation;

            if (data != null)
            {
                var position = context.GetDragPosition(this);

                if (this.ShouldReorder(position, data))
                {
                    if (this.ListView.swipedItem == data.Item)
                    {
                        this.ClearActionContent();
                    }
                    var newIndex = this.reorderCoordinator.ReorderItem(data.CurrentSourceReorderIndex, this);
                    data.CurrentSourceReorderIndex = newIndex;
                }
            }
            else if (this.ListView != null && this.ListView.isActionContentDisplayed)
            {
                var startPoint   = context.GetRelativeStartPosition();
                var currentPoint = context.GetDragPosition(this);

                this.dragX = currentPoint.X - startPoint.X;
                this.dragY = currentPoint.Y - startPoint.Y;

                this.UpdateActionContentClipping(this.ListView.Orientation == Windows.UI.Xaml.Controls.Orientation.Horizontal ? this.dragY : this.dragX);
            }
        }
Esempio n. 2
0
        void IDragDropElement.OnDrop(DragContext context)
        {
            if (context == null)
            {
                return;
            }

            var data = context.PayloadData as ReorderItemsDragOperation;

            if (data != null)
            {
                this.reorderCoordinator.CommitReorderOperation(data.InitialSourceIndex, data.CurrentSourceReorderIndex);
            }

            var startPoint   = context.GetRelativeStartPosition();
            var currentPoint = context.GetDragPosition(this);

            this.dragX = currentPoint.X - startPoint.X;
            this.dragY = currentPoint.Y - startPoint.Y;
        }