Ejemplo n.º 1
0
        //....................................................................

        void OnDragStarted(MouseButtonEventArgs e)
        {
            Grid.CaptureMouse();

            StartPoint = e.GetPosition(Grid);

            IsDragging = true;

            if (!ModifierKeys.Control.IsPressed() && !ModifierKeys.Shift.IsPressed())
            {
                Selections.TryClear();
            }

            PreviousSelection = new Rect();
        }
Ejemplo n.º 2
0
        void OnDragEnded(MouseButtonEventArgs e)
        {
            IsDragging = false;

            if (Grid.IsMouseCaptured)
            {
                Grid.ReleaseMouseCapture();
            }

            if (!Selections.TryAdd(PreviousSelection))
            {
                Selections.TryClear();
            }

            Selection.Set(new Rect(0, 0, 0, 0));

            StartPoint = default(Point);
        }