//.................................................................... void OnDragStarted(MouseButtonEventArgs e) { Grid.CaptureMouse(); StartPoint = e.GetPosition(Grid); IsDragging = true; if (!ModifierKeys.Control.IsPressed() && !ModifierKeys.Shift.IsPressed()) { Selections.TryClear(); } PreviousSelection = new Rect(); }
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); }