Пример #1
0
        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));
        }
Пример #2
0
        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));
        }