I'm having a weird WPF issue. I have two IMultiValueConverter
definitions in an assembly that is referenced by my WPF project. Their code is identical, but their names are different. I have cleaned and rebuilt the assemblies multiple times, but for some reason only one of the Value converters works, while the other one gives a 'does not exist in the clr namespace' xaml error.
Note: I know for a fact that the file is in the correct namespace and assembly that the project is referencing, because I reflected the dll directly out of the WPF project's bin folder.
Is there any explanation for this phenomenon?
//// this works
public class IndexConverter : IMultiValueConverter
{
public virtual object Convert(
object[] values, Type targetType,
object parameter, System.Globalization.CultureInfo culture)
{
var element = values[0] as Object;
var sequence = values[1] as IEnumerable;
return sequence.Cast<Object>().ToList().FindIndex(c => c.Equals(element)).ToString();
}
public virtual object[] ConvertBack(
object value, Type[] targetTypes,
object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
//// this gives me xaml errors
public class IndexConverterCopy : IMultiValueConverter
{
public virtual object Convert(
object[] values, Type targetType,
object parameter, System.Globalization.CultureInfo culture)
{
var element = values[0] as Object;
var sequence = values[1] as IEnumerable;
return sequence.Cast<Object>().ToList().FindIndex(c => c.Equals(element)).ToString();
}
public virtual object[] ConvertBack(
object value, Type[] targetTypes,
object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}