I have datagrid header which I populate from a viewmodel that work perfectly fine. Problem now is when I include HeaderStyle (Style)Resources["blnGridSelectAll"];
to have a checkbox on my header, once I include it the name of the column goes away. Below is the code to create columns
for (int i = 0; i<rvm.someclass.Count(); i++)
{
colNumber++;
var Col = new GenerateColumn();
Col.IsReadOnly = false;
Col.HeaderStyle = (Style)Resources["blnGridSelectAll"];
Col.CellStyle = hdrStyleCenter;
Col.Header = vm.someclass[i].Description.ToString();
AllowancesDataGrid.Columns.Add(Col);
}
XAML with the style
<Style TargetType="Primitives:DataGridColumnHeader" x:Name="blnGridSelectAll">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
<CheckBox IsChecked="false" HorizontalAlignment="Right" Visibility="Visible" x:Name="checkSelectAll" />
</StackPanel>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
Any idea how I can overcome this.