using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace BeWo.Converter
{
    public class StringFormatMulitConverter : IMultiValueConverter
    {
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            for (int i = 0; i < values.Length; i++)
            {
                if (values[i] == null || values[i] == DependencyProperty.UnsetValue)
                {
                    values[i] = string.Empty;
                }
            }

            if (parameter is string)
            {
                return string.Format(parameter as string, values);
            }

            return values;
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}