Example #1
0
        void StartDrag()
        {
            if (Recognizer is DragGestureRecognizer dragGestureRecognizer && dragGestureRecognizer.CanDrag)
            {
                if (Renderer == null)
                {
                    return;
                }

                var arg = dragGestureRecognizer.SendDragStarting(Renderer.Element);

                if (arg.Cancel)
                {
                    return;
                }

                s_currentDragStateData             = new CustomDragStateData();
                s_currentDragStateData.DataPackage = arg.Data;

                var target  = DragDropExtensions.DragDropContentType.Text;
                var strData = string.IsNullOrEmpty(arg.Data.Text) ? " " : arg.Data.Text;

                s_isDragging = true;

                DragDropExtensions.StartDrag(NativeView,
                                             target,
                                             strData,
                                             DragDropExtensions.DragDropActionType.Move,
                                             _iconCallback,
                                             null,
                                             null,
                                             _dragDoneCallback);
            }
        }
Example #2
0
        public void AddDropGesture()
        {
            if (Renderer == null)
            {
                return;
            }

            var target = DragDropExtensions.DragDropContentType.Targets;

            DragDropExtensions.AddDropTarget(NativeView,
                                             target,
                                             _dragEnterCallback,
                                             _dragLeaveCallback, null,
                                             _dropCallback);
        }