I have a really simple WPF converter:
internal class FlatTreeMarginConverter : IValueConverter
{
#region Fields
private static readonly Thickness _emptyThickness = new Thickness(0, 0, 0, 0);
#endregion
#region IValueConverter Members
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
FlatTreeViewItem tvi = value as FlatTreeViewItem;
if (tvi == null)
return _emptyThickness;
int nLevel = -1;
while (tvi != null)
{
tvi = tvi.GetVisualAncestor<FlatTreeViewItem>();
nLevel++;
}
return new Thickness(19 * nLevel, 0, 0, 0);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
#endregion
}
For some reason, the declaration in the Xaml has a blue squiggle under it with the exception "Object reference not set to instance.". The declaration just looks like:
I don't get it... everything in my code is safe. Any ideas? Or just some random VS bug?