Beispiel #1
0
        private void DragFinished(bool cancelled)
        {
            System.Windows.Input.Mouse.Capture(null);
            if (_isDragging)
            {
                AdornerLayer.GetAdornerLayer(_overlayElement.AdornedElement).Remove(_overlayElement);

                if (cancelled == false)
                {
                    Canvas.SetTop(_draggedElement, _originalTop + _overlayElement.TopOffset);
                    Canvas.SetLeft(_draggedElement, _originalLeft + _overlayElement.LeftOffset);
                    ctrVM.ChagneOriginXPosition(_originalLeft + _overlayElement.LeftOffset);
                    ctrVM.ChagneOriginYPosition(_originalTop + _overlayElement.TopOffset);
                }
                _overlayElement = null;

            }

            _isDragging = false;
            _isPreMouseDown = false;
        }
Beispiel #2
0
        private void DragStarted()
        {
            _isDragging = true;

            _originalLeft = Canvas.GetLeft(_draggedElement);
            _originalTop = Canvas.GetTop(_draggedElement);

            _overlayElement = new SimpleCircleAdorner(_draggedElement);
            layer = AdornerLayer.GetAdornerLayer(_draggedElement);
            layer.Add(_overlayElement);
        }