diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.Input/ColorPicker/ColorPicker.Properties.cs b/Microsoft.Toolkit.Uwp.UI.Controls.Input/ColorPicker/ColorPicker.Properties.cs index b21772a2ea9..1ec5deb495b 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.Input/ColorPicker/ColorPicker.Properties.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls.Input/ColorPicker/ColorPicker.Properties.cs @@ -20,7 +20,7 @@ public partial class ColorPicker nameof(CustomPaletteColors), typeof(ObservableCollection), typeof(ColorPicker), - new PropertyMetadata(Windows.UI.Color.FromArgb(0x00, 0x00, 0x00, 0x00))); + new PropertyMetadata(null)); /// /// Gets the list of custom palette colors. @@ -64,7 +64,7 @@ public int CustomPaletteColumnCount nameof(CustomPalette), typeof(IColorPalette), typeof(ColorPicker), - new PropertyMetadata(DependencyProperty.UnsetValue)); + new PropertyMetadata(null)); /// /// Gets or sets the custom color palette. diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.Input/ColorPicker/ColorToColorShadeConverter.cs b/Microsoft.Toolkit.Uwp.UI.Controls.Input/ColorPicker/ColorToColorShadeConverter.cs index a74e6e4ae54..f7676c93c8b 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.Input/ColorPicker/ColorToColorShadeConverter.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls.Input/ColorPicker/ColorToColorShadeConverter.cs @@ -5,6 +5,7 @@ using System; using Microsoft.Toolkit.Uwp.Helpers; using Windows.UI; +using Windows.UI.Xaml; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Media; @@ -40,7 +41,8 @@ public object Convert( } else { - throw new ArgumentException("Invalid color value provided"); + // Invalid color value provided + return DependencyProperty.UnsetValue; } // Get the value component delta @@ -50,7 +52,8 @@ public object Convert( } catch { - throw new ArgumentException("Invalid parameter provided, unable to convert to integer"); + // Invalid parameter provided, unable to convert to integer + return DependencyProperty.UnsetValue; } // Specially handle minimum (black) and maximum (white) @@ -119,7 +122,7 @@ public object ConvertBack( object parameter, string language) { - throw new NotImplementedException(); + return DependencyProperty.UnsetValue; } } } diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.Input/ColorPicker/ColorToHexConverter.cs b/Microsoft.Toolkit.Uwp.UI.Controls.Input/ColorPicker/ColorToHexConverter.cs index b460c8820fa..268094d502e 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.Input/ColorPicker/ColorToHexConverter.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls.Input/ColorPicker/ColorToHexConverter.cs @@ -5,6 +5,7 @@ using System; using Microsoft.Toolkit.Uwp.Helpers; using Windows.UI; +using Windows.UI.Xaml; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Media; @@ -34,7 +35,8 @@ public object Convert( } else { - throw new ArgumentException("Invalid color value provided"); + // Invalid color value provided + return DependencyProperty.UnsetValue; } string hexColor = color.ToHex().Replace("#", string.Empty); @@ -58,7 +60,8 @@ public object ConvertBack( } catch { - throw new ArgumentException("Invalid hex color value provided"); + // Invalid hex color value provided + return DependencyProperty.UnsetValue; } } else @@ -69,7 +72,8 @@ public object ConvertBack( } catch { - throw new ArgumentException("Invalid hex color value provided"); + // Invalid hex color value provided + return DependencyProperty.UnsetValue; } } } diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.Input/ColorPicker/ContrastBrushConverter.cs b/Microsoft.Toolkit.Uwp.UI.Controls.Input/ColorPicker/ContrastBrushConverter.cs index abd1dc1dbd7..b08611531ce 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.Input/ColorPicker/ContrastBrushConverter.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls.Input/ColorPicker/ContrastBrushConverter.cs @@ -4,6 +4,7 @@ using System; using Windows.UI; +using Windows.UI.Xaml; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Media; @@ -40,7 +41,8 @@ public object Convert( } else { - throw new ArgumentException("Invalid color value provided"); + // Invalid color value provided + return DependencyProperty.UnsetValue; } // Get the default color when transparency is high @@ -81,7 +83,7 @@ public object ConvertBack( object parameter, string language) { - throw new NotImplementedException(); + return DependencyProperty.UnsetValue; } /// diff --git a/Microsoft.Toolkit.Uwp.UI/Converters/ColorToDisplayNameConverter.cs b/Microsoft.Toolkit.Uwp.UI/Converters/ColorToDisplayNameConverter.cs index 5aa9a78cefe..5eb2b901be9 100644 --- a/Microsoft.Toolkit.Uwp.UI/Converters/ColorToDisplayNameConverter.cs +++ b/Microsoft.Toolkit.Uwp.UI/Converters/ColorToDisplayNameConverter.cs @@ -4,6 +4,7 @@ using System; using Windows.UI; +using Windows.UI.Xaml; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Media; @@ -33,7 +34,8 @@ public object Convert( } else { - throw new ArgumentException("Invalid color value provided"); + // Invalid color value provided + return DependencyProperty.UnsetValue; } return ColorHelper.ToDisplayName(color); @@ -46,7 +48,7 @@ public object ConvertBack( object parameter, string language) { - throw new NotImplementedException(); + return DependencyProperty.UnsetValue; } } } \ No newline at end of file