コード例 #1
0
 private void OnButtonClick(object sender, RoutedEventArgs routedEventArgs)
 {
     if (Keyboard.Modifiers == ModifierKeys.Control && !Popup.IsOpen)
     {
         routedEventArgs.Handled = true;
         Color = ScreenColorPickerDialog.Pick() ?? Color;
     }
 }
コード例 #2
0
        private void PickerButton_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            var picker = ColorPicker.GetLastOpened();

            if (picker?.Popup != null)
            {
                picker.Popup.StaysOpen = true;
            }

            Color = ScreenColorPickerDialog.Pick() ?? Color;

            if (picker?.Popup != null)
            {
                picker.Popup.Focus();
                picker.Popup.StaysOpen = false;
            }
        }