コード例 #1
0
        // From string to numeric (for the view model)
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
#if FORCE_NULLABLE_DOUBLE
            var valueEntered = ConvertValueToString(value);
            if (valueEntered.IsNotEmpty() && double.TryParse(valueEntered, out var valueAsDouble))
            {
                return(valueAsDouble as double?);
            }
#else
            if (ConvertBackFunc.IsNotNullOrDefault())
            {
                return(ConvertBackFunc(ConvertValueToString(value)));
            }
#endif

            return(default);
コード例 #2
0
 public TypedValueConverterBase(ConvertFunc convertFunc, ConvertBackFunc convertBackFunc = null)
 {
     _convertFunc     = convertFunc;
     _convertBackFunc = convertBackFunc;
 }