Beispiel #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);
            }
        }
        void IDragDropElement.DragOver(DragContext context)
        {
            if (context == null)
            {
                return;
            }

            var data = context.PayloadData as ReorderItemsDragOperation;

            if (data == null)
            {
                return;
            }

            var position = context.GetDragPosition(this);

            if (!this.ShouldReorder(position, data))
            {
                return;
            }

            if (this.Owner.swipedItem == data.Item)
            {
                this.Owner.ResetActionContent();
            }

            var newIndex = this.reorderCoordinator.ReorderItem(data.CurrentSourceReorderIndex, this);

            data.CurrentSourceReorderIndex = newIndex;
        }
Beispiel #3
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;
        }