There are a few of things wrong here. First, you don't need the converter. The StringFormat
property of the MultiBinding
will do this for you. Second, if you want to use a custom converter, you need to set the ConverterParameter
on the MultiBinding
, not StringFormat
.
Now, the reason why your converter isn't in that namespace: you declared it inside your window class. The full name of your converter is Test_Multibiding.MainWindow.StringFormatConverter
. It will compile (but your Converter
will have a NullReferenceException
as the parameter will be null) if you change your class to:
namespace Test_Multibiding
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
public class StringFormatConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType,
object parameter, System.Globalization.CultureInfo culture)
{
return string.Format(parameter.ToString(), values);
}
public object[] ConvertBack(object value, Type[] targetTypes,
object parameter, System.Globalization.CultureInfo culture)
{
throw new NotSupportedException("Cannot convert back");
}
}
}