diff --git a/src/modules/colorPicker/ColorPickerUI/Controls/ColorFormatControl.xaml b/src/modules/colorPicker/ColorPickerUI/Controls/ColorFormatControl.xaml
index 25d3c66d46..29bc856ed1 100644
--- a/src/modules/colorPicker/ColorPickerUI/Controls/ColorFormatControl.xaml
+++ b/src/modules/colorPicker/ColorPickerUI/Controls/ColorFormatControl.xaml
@@ -1,22 +1,18 @@
-
-
-
+
+ Margin="12,16,12,0"
+ Width="308"
+ Height="36"
+ CornerRadius="2"
+ HorizontalAlignment="Stretch"
+ Background="{DynamicResource ColorControlBackgroundBrush}">
@@ -42,32 +38,22 @@
IsReadOnly="True"
VerticalAlignment="Center"
Padding="8"
- AutomationProperties.LabeledBy="{Binding FormatNameTextBlock}"
+ AutomationProperties.LabeledBy="{Binding ElementName=FormatNameTextBlock, Path=Text}"
/>
+ AutomationProperties.Name="{x:Static p:Resources.Copy_to_clipboard}"
+ FontSize="12"
+ Style="{StaticResource DefaultButtonStyle}"
+ FontFamily="Segoe MDL2 Assets"
+ Content="" />
diff --git a/src/modules/colorPicker/ColorPickerUI/Controls/ColorPickerControl.xaml b/src/modules/colorPicker/ColorPickerUI/Controls/ColorPickerControl.xaml
index 0c6aa774fa..e733178df1 100644
--- a/src/modules/colorPicker/ColorPickerUI/Controls/ColorPickerControl.xaml
+++ b/src/modules/colorPicker/ColorPickerUI/Controls/ColorPickerControl.xaml
@@ -7,66 +7,283 @@
xmlns:p="clr-namespace:ColorPicker.Properties"
xmlns:ui="http://schemas.modernwpf.com/2019"
mc:Ignorable="d"
- Height="350"
- Width="333">
-
-
-
+ TabIndex="3"
+ FocusManager.IsFocusScope="True"
+ KeyboardNavigation.TabNavigation="Once"
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
+
+
+
+
+
+ ToolTipService.ToolTip="{x:Static p:Resources.Select_color}" />
+ ToolTipService.ToolTip="{x:Static p:Resources.Select_color}" />
+ ToolTipService.ToolTip="{x:Static p:Resources.Select_color}" />
+ ToolTipService.ToolTip="{x:Static p:Resources.Select_color}" />
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/modules/colorPicker/ColorPickerUI/Controls/ColorPickerControl.xaml.cs b/src/modules/colorPicker/ColorPickerUI/Controls/ColorPickerControl.xaml.cs
index 7af9ae29f0..4d887c4c1b 100644
--- a/src/modules/colorPicker/ColorPickerUI/Controls/ColorPickerControl.xaml.cs
+++ b/src/modules/colorPicker/ColorPickerUI/Controls/ColorPickerControl.xaml.cs
@@ -20,7 +20,6 @@ namespace ColorPicker.Controls
///
public partial class ColorPickerControl : UserControl
{
- private const int GradientPointerHalfWidth = 3;
private double _currH = 360;
private double _currS = 1;
private double _currV = 1;
@@ -93,7 +92,7 @@ namespace ColorPicker.Controls
gradientBrush.GradientStops.Add(stop);
}
- HueGradientGrid.Background = gradientBrush;
+ HueGradientSlider.Background = gradientBrush;
}
private static void SetColorVariationsForCurrentColor(DependencyObject d, (double hue, double saturation, double value) hsv)
@@ -122,9 +121,9 @@ namespace ColorPicker.Controls
private void UpdateValueColorGradient(double posX)
{
- valueGradientPointer.Margin = new Thickness(posX - GradientPointerHalfWidth, 0, 0, 0);
+ ValueGradientSlider.Value = posX;
- _currV = posX / ValueGradientGrid.Width;
+ _currV = posX / ValueGradientSlider.Maximum;
UpdateHueGradient(_currS, _currV);
@@ -134,9 +133,9 @@ namespace ColorPicker.Controls
private void UpdateSaturationColorGradient(double posX)
{
- saturationGradientPointer.Margin = new Thickness(posX - GradientPointerHalfWidth, 0, 0, 0);
+ SaturationGradientSlider.Value = posX;
- _currS = posX / SaturationGradientGrid.Width;
+ _currS = posX / HueGradientSlider.Maximum;
UpdateHueGradient(_currS, _currV);
@@ -146,9 +145,8 @@ namespace ColorPicker.Controls
private void UpdateHueColorGradient(double posX)
{
- hueGradientPointer.Margin = new Thickness(posX - GradientPointerHalfWidth, 0, 0, 0);
-
- _currH = posX / HueGradientGrid.Width * 360;
+ HueGradientSlider.Value = posX;
+ _currH = posX / HueGradientSlider.Maximum * 360;
SaturationStartColor.Color = HSVColor.RGBFromHSV(_currH, 0f, _currV);
SaturationStopColor.Color = HSVColor.RGBFromHSV(_currH, 1f, _currV);
@@ -184,7 +182,6 @@ namespace ColorPicker.Controls
{
if (_isCollapsed)
{
- detailsGrid.Visibility = Visibility.Visible;
_isCollapsed = false;
var opacityAppear = new DoubleAnimation(1.0, new Duration(TimeSpan.FromMilliseconds(300)));
@@ -202,8 +199,6 @@ namespace ColorPicker.Controls
ControlHelper.SetCornerRadius(CurrentColorButton, new CornerRadius(2));
CurrentColorButton.BeginAnimation(Button.WidthProperty, resizeColor);
CurrentColorButton.BeginAnimation(Button.MarginProperty, moveColor);
- detailsStackPanel.BeginAnimation(StackPanel.OpacityProperty, opacityAppear);
- detailsGrid.BeginAnimation(Grid.HeightProperty, resize);
CurrentColorButton.IsEnabled = false;
SessionEventHelper.Event.EditorAdjustColorOpened = true;
}
@@ -230,9 +225,6 @@ namespace ColorPicker.Controls
ControlHelper.SetCornerRadius(CurrentColorButton, new CornerRadius(0));
CurrentColorButton.BeginAnimation(Button.WidthProperty, resizeColor);
CurrentColorButton.BeginAnimation(Button.MarginProperty, moveColor);
- detailsStackPanel.BeginAnimation(Window.OpacityProperty, opacityAppear);
- detailsGrid.BeginAnimation(Grid.HeightProperty, resize);
- detailsGrid.Visibility = Visibility.Collapsed;
CurrentColorButton.IsEnabled = true;
}
}
@@ -242,9 +234,12 @@ namespace ColorPicker.Controls
HideDetails();
SelectedColorChangedCommand.Execute(_currentColor);
SessionEventHelper.Event.EditorColorAdjusted = true;
+ DetailsFlyout.Hide();
}
- private void CancelButton_Click(object sender, RoutedEventArgs e)
+#pragma warning disable CA1801 // Review unused parameters
+ private void DetailsFlyout_Closed(object sender, object e)
+#pragma warning restore CA1801 // Review unused parameters
{
HideDetails();
@@ -262,69 +257,30 @@ namespace ColorPicker.Controls
SessionEventHelper.Event.EditorSimilarColorPicked = true;
}
- private void ValueGradientGrid_MouseMove(object sender, MouseEventArgs e)
+ private void SaturationGradientSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
{
- if (e.LeftButton == MouseButtonState.Pressed)
- {
- var pos = GetMousePositionWithinGrid(sender as Border);
- UpdateValueColorGradient(pos.X);
- _ignoreGradientsChanges = true;
- UpdateTextBoxesAndCurrentColor(HSVColor.RGBFromHSV(_currH, _currS, _currV));
- _ignoreGradientsChanges = false;
- }
- }
-
- private void ValueGradientGrid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
- {
- var pos = GetMousePositionWithinGrid(sender as Border);
- UpdateValueColorGradient(pos.X);
+ UpdateSaturationColorGradient((sender as Slider).Value);
_ignoreGradientsChanges = true;
UpdateTextBoxesAndCurrentColor(HSVColor.RGBFromHSV(_currH, _currS, _currV));
_ignoreGradientsChanges = false;
}
- private void SaturationGradientGrid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+ private void HueGradientSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
{
- var pos = GetMousePositionWithinGrid(sender as Border);
- UpdateSaturationColorGradient(pos.X);
+ UpdateHueColorGradient((sender as Slider).Value);
_ignoreGradientsChanges = true;
UpdateTextBoxesAndCurrentColor(HSVColor.RGBFromHSV(_currH, _currS, _currV));
_ignoreGradientsChanges = false;
}
- private void SaturationGradientGrid_MouseMove(object sender, MouseEventArgs e)
+ private void ValueGradientSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
{
- if (e.LeftButton == MouseButtonState.Pressed)
- {
- var pos = GetMousePositionWithinGrid(sender as Border);
- UpdateSaturationColorGradient(pos.X);
- _ignoreGradientsChanges = true;
- UpdateTextBoxesAndCurrentColor(HSVColor.RGBFromHSV(_currH, _currS, _currV));
- _ignoreGradientsChanges = false;
- }
- }
-
- private void HueGradientGrid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
- {
- var pos = GetMousePositionWithinGrid(sender as Border);
- UpdateHueColorGradient(pos.X);
+ UpdateValueColorGradient((sender as Slider).Value);
_ignoreGradientsChanges = true;
UpdateTextBoxesAndCurrentColor(HSVColor.RGBFromHSV(_currH, _currS, _currV));
_ignoreGradientsChanges = false;
}
- private void HueGradientGrid_MouseMove(object sender, MouseEventArgs e)
- {
- if (e.LeftButton == MouseButtonState.Pressed)
- {
- var pos = GetMousePositionWithinGrid(sender as Border);
- UpdateHueColorGradient(pos.X);
- _ignoreGradientsChanges = true;
- UpdateTextBoxesAndCurrentColor(HSVColor.RGBFromHSV(_currH, _currS, _currV));
- _ignoreGradientsChanges = false;
- }
- }
-
private static Point GetMousePositionWithinGrid(Border border)
{
var pos = System.Windows.Input.Mouse.GetPosition(border);
@@ -385,9 +341,9 @@ namespace ColorPicker.Controls
{
var hsv = ColorHelper.ConvertToHSVColor(color);
- var huePosition = (hsv.hue / 360) * HueGradientGrid.Width;
- var saturationPosition = hsv.saturation * SaturationGradientGrid.Width;
- var valuePosition = hsv.value * ValueGradientGrid.Width;
+ var huePosition = (hsv.hue / 360) * HueGradientSlider.Maximum;
+ var saturationPosition = hsv.saturation * SaturationGradientSlider.Maximum;
+ var valuePosition = hsv.value * ValueGradientSlider.Maximum;
UpdateHueColorGradient(huePosition);
UpdateSaturationColorGradient(saturationPosition);
UpdateValueColorGradient(valuePosition);
@@ -403,7 +359,7 @@ namespace ColorPicker.Controls
private void HexCode_GotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
{
- (sender as TextBox).SelectAll();
+ (sender as System.Windows.Controls.TextBox).SelectAll();
}
}
}
diff --git a/src/modules/colorPicker/ColorPickerUI/Properties/Resources.Designer.cs b/src/modules/colorPicker/ColorPickerUI/Properties/Resources.Designer.cs
index 43312c8674..fa5992c62f 100644
--- a/src/modules/colorPicker/ColorPickerUI/Properties/Resources.Designer.cs
+++ b/src/modules/colorPicker/ColorPickerUI/Properties/Resources.Designer.cs
@@ -141,15 +141,6 @@ namespace ColorPicker.Properties {
}
}
- ///
- /// Looks up a localized string similar to OK.
- ///
- public static string OK {
- get {
- return ResourceManager.GetString("OK", resourceCulture);
- }
- }
-
///
/// Looks up a localized string similar to Open settings.
///
@@ -195,6 +186,15 @@ namespace ColorPicker.Properties {
}
}
+ ///
+ /// Looks up a localized string similar to Select.
+ ///
+ public static string Select {
+ get {
+ return ResourceManager.GetString("Select", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Select color.
///
diff --git a/src/modules/colorPicker/ColorPickerUI/Properties/Resources.resx b/src/modules/colorPicker/ColorPickerUI/Properties/Resources.resx
index 1fcefffaa4..fb9e9aeb3e 100644
--- a/src/modules/colorPicker/ColorPickerUI/Properties/Resources.resx
+++ b/src/modules/colorPicker/ColorPickerUI/Properties/Resources.resx
@@ -153,9 +153,9 @@
Press the Color Picker icon to capture a color from your screen.
Message that shows when the user launches the window for the first time or when no colors have been selected
-
- OK
- OK button content
+
+ Select
+ Select button content
Open settings
diff --git a/src/modules/colorPicker/ColorPickerUI/Resources/Styles.xaml b/src/modules/colorPicker/ColorPickerUI/Resources/Styles.xaml
index f38968d618..6f6c811c50 100644
--- a/src/modules/colorPicker/ColorPickerUI/Resources/Styles.xaml
+++ b/src/modules/colorPicker/ColorPickerUI/Resources/Styles.xaml
@@ -8,33 +8,23 @@
-
-
+
-
-
+
+
+
-
+
@@ -83,7 +73,7 @@
-
+
@@ -105,7 +95,7 @@
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Focusable="False"
- Opacity="0"
+ Visibility="Collapsed"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
@@ -114,12 +104,13 @@
-
+
-
+
diff --git a/src/modules/colorPicker/ColorPickerUI/Views/ColorEditorView.xaml b/src/modules/colorPicker/ColorPickerUI/Views/ColorEditorView.xaml
index 94b33c40e7..f269327d6b 100644
--- a/src/modules/colorPicker/ColorPickerUI/Views/ColorEditorView.xaml
+++ b/src/modules/colorPicker/ColorPickerUI/Views/ColorEditorView.xaml
@@ -1,16 +1,15 @@
@@ -24,7 +23,10 @@
Margin="0,48,0,0"
Grid.Row="1"
Padding="0"
- TabIndex="3"
+ TabIndex="2"
+ Width="64"
+ HorizontalAlignment="Center"
+ ui:FocusVisualHelper.UseSystemFocusVisuals="True"
ItemsSource="{Binding ColorsHistory}"
SelectedIndex="{Binding SelectedColorIndex}"
ItemContainerStyle="{DynamicResource ColorHistoryListViewStyle}"
@@ -93,20 +95,28 @@
+
-
-
+
+
-
+
-
+
-
+