public object Convert(object value, Type targetType, object parameter, string language) { bool?boolValue = value as bool?; if (boolValue == null) { boolValue = false; } if (Test == boolValue.Value) { return(TypeConverterHelper.TryConvertValue(TrueValue, targetType)); } return(TypeConverterHelper.TryConvertValue(FalseValue, targetType)); }
public object Convert(object value, Type targetType, object parameter, string language) { if (value == null) { return(TypeConverterHelper.TryConvertValue(TrueValue, targetType)); } if (value is string) { string stringValue = value as string; if (stringValue == String.Empty) { return(TypeConverterHelper.TryConvertValue(TrueValue, targetType)); } } return(TypeConverterHelper.TryConvertValue(FalseValue, targetType)); }