I'm trying to bind an observable collection to a WPF DataGrid. One of my properties is a bool. I dislike DataGrid's CheckboxColumn, so I rolled my own with a TemplateColumn, which I bind to a public property on my DataContext. The project designs, compiles, and runs fine. However, in the designer, Visual Studio 2013 Professional underlines the binding path in red. When I hover over it, it says "Property Expected". Strangely enough, this does not show up in the Error List but the scrollbar DOES get the red "error marker" on it. Additionally, if I use a "standard" CheckboxColumn, VS doesn't show the underline.
Here's my DataContext's class:
sealed class Connection : IDisposable
{
public bool Log { get; set; }
public int HashCode { get; private set; }
}
And this is the DataGrid's XAML:
<DataGrid AutoGenerateColumns="False" ItemsSource="{Binding Path=Connections}" SelectionMode="Single">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Path=HashCode, StringFormat={}{0:X}}" Header="ID" IsReadOnly="True" Width="50*"/>
<DataGridTemplateColumn Header="Log">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox HorizontalAlignment="Center" VerticalAlignment="Center" IsChecked="{Binding Path=Log, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
Here's a screenshot of the error:
Strangely enough, VS is fine with this XAML, which I don't want to use due to the behavior of the column:
<DataGrid AutoGenerateColumns="False" ItemsSource="{Binding Path=Connections}" SelectionMode="Single">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Path=HashCode, StringFormat={}{0:X}}" Header="ID" IsReadOnly="True" Width="50*"/>
<DataGridCheckBoxColumn Binding="{Binding Path=Log, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Header="Log" />
</DataGrid.Columns>
</DataGrid>
As I said, it compiles and runs fine. Is this a bug in Visual Studio?