protected override void OnPreviewMouseUp(MouseButtonEventArgs e) { if (draggingInfo != null) { bool justClick = Mouse.GetPosition(this) == draggingInfo.ClickDownLocation; draggingInfo = null; ImageCursor = Cursors.None; updatePickerPosition(Mouse.GetPosition(clipboardImage)); if (justClick) { // this was a click, not a drag: copy color (DataContext as ClipboardManager).ReloadPickerColor(); } } base.OnPreviewMouseUp(e); }
protected override void OnPreviewMouseDown(MouseButtonEventArgs e) { if (!isMouseOverImagePanel()) return; if (e.LeftButton != MouseButtonState.Pressed) return; draggingInfo = new DraggingInfo( Mouse.GetPosition(this), horizontalScrollbar.Value, verticalScrollbar.Value); ImageCursor = Cursors.Hand; (DataContext as ClipboardManager).HidePicker(); e.Handled = true; base.OnPreviewMouseDown(e); }