Skip to content

Commit d19a282

Browse files
committed
Derive from the WinUI ColorPicker
1 parent ff39e42 commit d19a282

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

Microsoft.Toolkit.Uwp.UI.Controls.Input/ColorPicker/ColorPicker.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
5353
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1501:Statement should not be on a single line", Justification = "Inline brackets are used to improve code readability with repeated null checks.")]
5454
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1025:Code should not contain multiple whitespace in a row", Justification = "Whitespace is used to align code in columns for readability.")]
5555
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1306:Field names should begin with lower-case letter", Justification = "Only template parts start with a capital letter. This differentiates them from other fields.")]
56-
public partial class ColorPicker : Windows.UI.Xaml.Controls.ColorPicker
56+
public partial class ColorPicker : Microsoft.UI.Xaml.Controls.ColorPicker
5757
{
5858
internal Color CheckerBackgroundColor { get; set; } = Color.FromArgb(0x19, 0x80, 0x80, 0x80); // Overridden later
5959

@@ -123,6 +123,7 @@ public partial class ColorPicker : Windows.UI.Xaml.Controls.ColorPicker
123123
public ColorPicker()
124124
{
125125
this.DefaultStyleKey = typeof(ColorPicker);
126+
this.DefaultStyleResourceUri = new System.Uri("ms-appx:///Microsoft.Toolkit.Uwp.UI.Controls.Input/Themes/Generic.xaml");
126127

127128
// Setup collections
128129
this.SetValue(CustomPaletteColorsProperty, new ObservableCollection<Color>());
@@ -487,22 +488,22 @@ private ColorChannel GetActiveColorSpectrumThirdDimension()
487488
{
488489
switch (this.ColorSpectrumComponents)
489490
{
490-
case Windows.UI.Xaml.Controls.ColorSpectrumComponents.SaturationValue:
491-
case Windows.UI.Xaml.Controls.ColorSpectrumComponents.ValueSaturation:
491+
case Microsoft.UI.Xaml.Controls.ColorSpectrumComponents.SaturationValue:
492+
case Microsoft.UI.Xaml.Controls.ColorSpectrumComponents.ValueSaturation:
492493
{
493494
// Hue
494495
return ColorChannel.Channel1;
495496
}
496497

497-
case Windows.UI.Xaml.Controls.ColorSpectrumComponents.HueValue:
498-
case Windows.UI.Xaml.Controls.ColorSpectrumComponents.ValueHue:
498+
case Microsoft.UI.Xaml.Controls.ColorSpectrumComponents.HueValue:
499+
case Microsoft.UI.Xaml.Controls.ColorSpectrumComponents.ValueHue:
499500
{
500501
// Saturation
501502
return ColorChannel.Channel2;
502503
}
503504

504-
case Windows.UI.Xaml.Controls.ColorSpectrumComponents.HueSaturation:
505-
case Windows.UI.Xaml.Controls.ColorSpectrumComponents.SaturationHue:
505+
case Microsoft.UI.Xaml.Controls.ColorSpectrumComponents.HueSaturation:
506+
case Microsoft.UI.Xaml.Controls.ColorSpectrumComponents.SaturationHue:
506507
{
507508
// Value
508509
return ColorChannel.Channel3;
@@ -1126,7 +1127,7 @@ private void DispatcherQueueTimer_Tick(object sender, object e)
11261127
***************************************************************************************/
11271128

11281129
/// <summary>
1129-
/// Callback for when the <see cref="Windows.UI.Xaml.Controls.ColorPicker.Color"/> dependency property value changes.
1130+
/// Callback for when the <see cref="Microsoft.UI.Xaml.Controls.ColorPicker.Color"/> dependency property value changes.
11301131
/// </summary>
11311132
private void OnColorChanged(DependencyObject d, DependencyProperty e)
11321133
{

Microsoft.Toolkit.Uwp.UI.Controls.Input/ColorPicker/ColorPickerButton.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ protected override void OnApplyTemplate()
142142
}
143143
}
144144

145-
private void ColorPicker_ColorChanged(Windows.UI.Xaml.Controls.ColorPicker sender, ColorChangedEventArgs args)
145+
private void ColorPicker_ColorChanged(Microsoft.UI.Xaml.Controls.ColorPicker sender, Microsoft.UI.Xaml.Controls.ColorChangedEventArgs args)
146146
{
147147
SelectedColor = args.NewColor;
148148
}

0 commit comments

Comments
 (0)