I'm trying to bind a ViewModel property to a Checkbox in the header of a DataGrid.
The checkbox binds just fine if I stick it randomly in the window, but if its in the header of the datagrid, it doesn't bind in either direction.
The data in the DataGrid binds fine as well.
The issue seems to be that the HeaderTemplate isn't binding to the main view model. I assume its binding ItemSource.
How do I bind to the view model in the header?
<DataGrid ItemsSource="{Binding Channels}" AlternationCount="2" Grid.IsSharedSizeScope="True" AutoGenerateColumns="False" AlternatingRowBackground="{StaticResource GroupBackgroundBrush}" SelectedIndex="{Binding Path=CursorChannelInt}" >
<DataGrid.Columns>
<DataGridTemplateColumn>
<DataGridTemplateColumn.HeaderTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding Path=Test}">Test Chkbox</CheckBox>
</DataTemplate>
</DataGridTemplateColumn.HeaderTemplate>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=stuff}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>