private void ScopeMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            ControlCanvas.ReleaseMouseCapture();
            if (!_isDragging)
            {
                return;
            }

            _isDragging = false;

            var endPosition = e.GetPosition(this);

            endPosition.X += (4 * ScrollPosition);

            var startPosition = _firstMousePoint;

            startPosition.X += (4 * ScrollPosition);

            AddScopeMeasure(startPosition, endPosition);
            InvalidateVisual();
        }
        private void ScopeMouseMove(object sender, System.Windows.Input.MouseEventArgs e)
        {
            var position = e.GetPosition(this);

            if (!ValidatePosition(position))
            {
                ControlCanvas.ReleaseMouseCapture();
                _isDragging = false;

                InvalidateVisual();
            }


            if (_isDragging)
            {
                _lastMousePoint = position;
                InvalidateVisual();
            }

            CursorX.Content = "X: " + position.X;
            CursorY.Content = "Y: " + position.Y;
        }
 private void ControlCanvas_MouseLeave(object sender, MouseEventArgs e)
 {
     _isDragging = false;
     ControlCanvas.ReleaseMouseCapture();
 }