Beispiel #1
0
        private void DragStarted()
        {
            _isDragging   = true;
            _originalLeft = veiw.Margin.Left; //   Canvas.GetLeft(_originalElement);
            _originalTop  = veiw.Margin.Top;  //Canvas.GetTop(_originalElement);

            _overlayElement = new SimpleCircleAdorner(_originalElement);
            AdornerLayer layer = AdornerLayer.GetAdornerLayer(_originalElement);

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

                if (cancelled == false)
                {
                    veiw.Margin = new Thickness((_originalLeft + _overlayElement.LeftOffset), (_originalTop + _overlayElement.TopOffset), 0, 0);
                    //veiw.Margin.Top = _originalTop + _overlayElement.TopOffset;
                    //veiw.SetLeft(_originalElement, _originalLeft + _overlayElement.LeftOffset);
                }
                _overlayElement = null;
            }
            _isDragging = false;
            _isDown     = false;
        }
Beispiel #3
0
        private void DragStarted()
        {
            _isDragging = true;
            _originalLeft = veiw.Margin.Left; //   Canvas.GetLeft(_originalElement);
            _originalTop = veiw.Margin.Top;//Canvas.GetTop(_originalElement);

            _overlayElement = new SimpleCircleAdorner(_originalElement);
            AdornerLayer layer = AdornerLayer.GetAdornerLayer(_originalElement);
            layer.Add(_overlayElement);
        }
Beispiel #4
0
        private void DragFinished(bool cancelled)
        {
            System.Windows.Input.Mouse.Capture(null);
            if (_isDragging)
            {
                AdornerLayer.GetAdornerLayer(_overlayElement.AdornedElement).Remove(_overlayElement);

                if (cancelled == false)
                {
                    veiw.Margin = new Thickness((_originalLeft + _overlayElement.LeftOffset), (_originalTop + _overlayElement.TopOffset), 0, 0);
                    //veiw.Margin.Top = _originalTop + _overlayElement.TopOffset;
                    //veiw.SetLeft(_originalElement, _originalLeft + _overlayElement.LeftOffset);
                }
                _overlayElement = null;

            }
            _isDragging = false;
            _isDown = false;
        }