I have a strange XAML Error that comes up in Visual Studio. I have Isolated it to the code below which causes it. The XAML designer errors when the converter below is used, however the application runs just fine without error. I like to keep the code tidy and remove all warnings and errors, what do I need to do to get rid of this one?
[ValueConversion(typeof(double?), typeof(double?))]
public class SummaryConverter : IValueConverter
{
#region IValueConverter Members
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
CollectionViewGroup group = value as CollectionViewGroup ;
if (parameter.ToString() == "FieldName")
{
double suUnits = 0;
foreach (var t in group.Items) //This Line here causes error on XAML
{
suUnits += t.FieldName.GetValueOrDefault();
}
return suUnits;
}
return "";
}