Skip to content

Commit ba74667

Browse files
committed
1 parent d509455 commit ba74667

File tree

7 files changed

+14
-8
lines changed

7 files changed

+14
-8
lines changed

Microsoft.Toolkit.Uwp.SampleApp/SamplePages/EnumValuesExtension/AnimalToColorConverter.xaml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System;
66
using Microsoft.Toolkit.Uwp.SampleApp.Enums;
77
using Windows.UI;
8+
using Windows.UI.Xaml;
89
using Windows.UI.Xaml.Data;
910

1011
namespace Microsoft.Toolkit.Uwp.SampleApp.Converters
@@ -21,7 +22,7 @@ public object Convert(object value, Type targetType, object parameter, string la
2122
Animal.Llama => Colors.Beige,
2223
Animal.Parrot => Colors.YellowGreen,
2324
Animal.Squirrel => Colors.SaddleBrown,
24-
_ => throw new ArgumentException("Invalid value", nameof(value))
25+
_ => DependencyProperty.UnsetValue
2526
};
2627
}
2728

Microsoft.Toolkit.Uwp.SampleApp/SamplePages/EnumValuesExtension/EnumValuesExtensionCode.bind

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public sealed class AnimalToColorConverter : IValueConverter
2020
Animal.Bunny => Colors.Green,
2121
Animal.Parrot => Colors.YellowGreen,
2222
Animal.Squirrel => Colors.SaddleBrown,
23-
_ => throw new ArgumentException("Invalid value", nameof(value))
23+
_ => DependencyProperty.UnsetValue
2424
};
2525
}
2626

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System;
66
using Microsoft.Toolkit.Uwp.Helpers;
77
using Windows.UI;
8+
using Windows.UI.Xaml;
89
using Windows.UI.Xaml.Data;
910
using Windows.UI.Xaml.Media;
1011

@@ -40,7 +41,7 @@ public object Convert(
4041
}
4142
else
4243
{
43-
throw new ArgumentException("Invalid color value provided");
44+
return DependencyProperty.UnsetValue;
4445
}
4546

4647
// Get the value component delta
@@ -50,7 +51,7 @@ public object Convert(
5051
}
5152
catch
5253
{
53-
throw new ArgumentException("Invalid parameter provided, unable to convert to integer");
54+
return DependencyProperty.UnsetValue;
5455
}
5556

5657
// Specially handle minimum (black) and maximum (white)

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System;
66
using Microsoft.Toolkit.Uwp.Helpers;
77
using Windows.UI;
8+
using Windows.UI.Xaml;
89
using Windows.UI.Xaml.Data;
910
using Windows.UI.Xaml.Media;
1011

@@ -34,7 +35,7 @@ public object Convert(
3435
}
3536
else
3637
{
37-
throw new ArgumentException("Invalid color value provided");
38+
return DependencyProperty.UnsetValue;
3839
}
3940

4041
string hexColor = color.ToHex().Replace("#", string.Empty);

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
using System;
66
using Windows.UI;
7+
using Windows.UI.Xaml;
78
using Windows.UI.Xaml.Data;
89
using Windows.UI.Xaml.Media;
910

@@ -40,7 +41,7 @@ public object Convert(
4041
}
4142
else
4243
{
43-
throw new ArgumentException("Invalid color value provided");
44+
return DependencyProperty.UnsetValue;
4445
}
4546

4647
// Get the default color when transparency is high

Microsoft.Toolkit.Uwp.UI/Converters/ColorToDisplayNameConverter.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
using System;
66
using Windows.UI;
7+
using Windows.UI.Xaml;
78
using Windows.UI.Xaml.Data;
89
using Windows.UI.Xaml.Media;
910

@@ -33,7 +34,7 @@ public object Convert(
3334
}
3435
else
3536
{
36-
throw new ArgumentException("Invalid color value provided");
37+
return DependencyProperty.UnsetValue;
3738
}
3839

3940
return ColorHelper.ToDisplayName(color);

Microsoft.Toolkit.Uwp.UI/Converters/TaskResultConverter.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
using System;
66
using System.Threading.Tasks;
7+
using Windows.UI.Xaml;
78
using Windows.UI.Xaml.Data;
89

910
namespace Microsoft.Toolkit.Uwp.UI.Converters
@@ -26,7 +27,7 @@ public object Convert(object value, Type targetType, object parameter, string la
2627
return task.GetResultOrDefault();
2728
}
2829

29-
return null;
30+
return DependencyProperty.UnsetValue;
3031
}
3132

3233
/// <inheritdoc/>

0 commit comments

Comments
 (0)