Ejemplo n.º 1
0
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == DependencyProperty.UnsetValue)
            {
                return(value);
            }
            else if (Converter1 == null || Converter2 == null)
            {
                List <IValueConverter> convertersReverseList = new List <IValueConverter>(Converters);
                convertersReverseList.Reverse();

                foreach (var converter in convertersReverseList)
                {
                    value = converter.ConvertBack(value, targetType, parameter, culture);
                    if (value == Binding.DoNothing)
                    {
                        return(Binding.DoNothing);
                    }
                    if (value == DependencyProperty.UnsetValue)
                    {
                        return(DependencyProperty.UnsetValue);
                    }
                }

                return(value);
            }
            else
            {
                return(Converter1.ConvertBack(Converter2.ConvertBack(value, targetType, parameter, culture), targetType, parameter, culture));
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Converts back a value by passing it consecutive to the set converters in back order.
        /// </summary>
        /// <param name="value">Value to be converted back.</param>
        /// <param name="targetType">TargetType parameter is send to set converters.</param>
        /// <param name="parameter">This parameter is send to set converters.</param>
        /// <param name="culture">Culture parameter is send to set converters.</param>
        /// <returns>Converted value back from the reversed consecutive execution of the set converters.</returns>
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            object convertedValue = Converter2.ConvertBack(value, targetType, parameter, culture);

            return(Converter1.ConvertBack(convertedValue, targetType, parameter, culture));
        }