I fill my datagrid in code behind like this:
var customers = from c in _db.Customers
select c;
TheDataGrid.ItemsSource = customers.ToList();
In my XAML below, the DataGrid.RowBackground works but the DataGridHeaderBorder gets the error "The Items listing must be empty before the use of ItemsSource" in the code-behind upon runtime.
This is odd because I'm just trying to change the color of the Datagrid headers and it gets a problem with ItemsSource. If I take the DataGridHeaderBorder line out, it works fine.
So how does one simply change the color of the column headers on a Datagrid?
<toolkit:DataGridHeaderBorder Background="yellow"/>
<toolkit:DataGrid.RowBackground>
<LinearGradientBrush EndPoint="-0.136,-0.163" StartPoint="1.291,1.248">
<GradientStop Color="#FFA8A929" Offset="0.004"/>
<GradientStop Color="#FFF7F7ED" Offset="0.991"/>
</LinearGradientBrush>
</toolkit:DataGrid.RowBackground>