Holds information about an error that occured in MultiBinding conversion.
        object IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            object converter = Converter;

            if (converter == null) return value;

            object converterParameter = ConverterParameter;
            SourceValuesErrors = null;
            try
            {
                if (converter is IMultiValueConverter)
                {
                    // Guess target types based on current source values
                    Type[] targetTypes = new Type[m_sourceCount];
                    for (int i = 0; i < targetTypes.Length; i++)
                    {
                        object currentValue = Target.GetValue(dataProperties[m_sourceStartIndex + i]);
                        targetTypes[i] = currentValue != null ? currentValue.GetType() : typeof(Object);
                    }
                    
                    object[] convertedValues = ((IMultiValueConverter)converter).ConvertBack(value, targetTypes, converterParameter, culture);
                    
                    return convertedValues;
                }
                else if (converter is IValueConverter)
                {
                    object convertedValue = ((IValueConverter)converter).ConvertBack(value, targetType, converterParameter, culture);
                    return convertedValue != DependencyProperty.UnsetValue ? new object[] { convertedValue } : convertedValue;
                }
            }
            catch (Exception ex)
            {
                
                SourceValuesErrors = new MultiBindingValidationError[] { new MultiBindingValidationError(ex) };
                if (MultiBinding.ValidatesOnExceptions)
                {
                    return DependencyProperty.UnsetValue;
                }
                throw;
            }
                
            return value;
        }
        object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null) return DependencyProperty.UnsetValue;
            object[] unconvertedValues = (object[])value;
            object converter = Converter;

            object result = unconvertedValues;
            if (converter != null)
            {
                object converterParameter = ConverterParameter;
                SourceValuesErrors = null;
                try
                {
                    IMultiValueConverter multiConverter = converter as IMultiValueConverter;
                    if (multiConverter != null)
                    {
                        result = multiConverter.Convert(unconvertedValues, targetType, converterParameter, culture);
                    }
                    else
                    {
                        IValueConverter singleConverter = converter as IValueConverter;
                        if (singleConverter != null)
                        {
                            result = singleConverter.Convert(unconvertedValues[0], targetType, converterParameter, culture);
                        }
                    }
                }
                catch (Exception ex)
                {
                    
                    SourceValuesErrors = new MultiBindingValidationError[] { new MultiBindingValidationError(ex) };
                    if (MultiBinding.ValidatesOnExceptions)
                    {
                        return DependencyProperty.UnsetValue;
                    }
                    throw;
                }

            }


            if (result != DependencyProperty.UnsetValue)
            {

                String format = StringFormat;
                if (format != null)
                {
                    format = Regex.Replace(format, @"%(\d+)", "{$1}");
                    if (result is Object[])
                    {
                        result = String.Format(culture, format, (Object[])result);
                    }
                    else
                    {
                        result = String.Format(culture, format, result);
                    }
                }
            }
            return result;
        }