diff --git a/Application/FileConverter/ValueConverters/Generic/BoolToVisibility.cs b/Application/FileConverter/ValueConverters/Generic/BoolToVisibility.cs index e278ef6..5a6d03f 100644 --- a/Application/FileConverter/ValueConverters/Generic/BoolToVisibility.cs +++ b/Application/FileConverter/ValueConverters/Generic/BoolToVisibility.cs @@ -10,11 +10,13 @@ namespace FileConverter.ValueConverters.Generic { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - if (!(value is bool)) + if (value != null && !(value is bool)) { throw new ArgumentException("The value must be a boolean."); } + bool booleanValue = (bool?) value ?? false; + string stringParameter = parameter as string; string trueResult = "Visible"; @@ -35,7 +37,6 @@ namespace FileConverter.ValueConverters.Generic } } - bool booleanValue = (bool)value; return booleanValue ? trueResult : falseResult; }