Example #1
0
        internal object ConvertBack([CanBeNull] object value, [NotNull] Type targetType, [CanBeNull] object parameter)
        {
            var valueConverter = ValueConverterFactory.GetOrCreate(_converterType);

            try
            {
                return(valueConverter.ConvertBack(value, targetType, parameter, _converterCulture));
            }
            catch (Exception ex)
            {
                Log($"An \"{LogFormatter.FormatException(ex)}\" exception occurred while converting \"{value ?? "null"}\" value from the target item to the source one " +
                    $"using \"{LogFormatter.FormatTypeName(_converterType)}\" value converter. This might reduce binding performance. " +
                    $"Please return \"{nameof(BindingValue)}.{nameof(BindingValue.UnsetValue)}\" value instead of rising an exception.");

                return(BindingValue.UnsetValue);
            }
        }