Setting GroupByRecordPresenter's Background

John Doe / Tuesday, February 09, 2010

Why is not the background of the GroupByRecordPresenter now changing when I set its Background property?

 

This is because the Background of the Record Content Site (where the description is) of the GroupByRecordPresenter is bound to the current theme's LabelBackground brush with the following binding : Background="{DynamicResource {ComponentResourceKey {x:Type igDP:XamDataGrid}, LabelBackground}}". Only the area underneath the record selector is bound to the Background property of the GroupByRecordPresenter.

Default

If the theme changes, the Background of the Record content site will change accordingly:

Theme

However, if you do not want to use a theme, but you want to be able to change the Background of the GroupByRecordPresenter the same way the Theme changes it, you have to retemplate it and change the binding expression that the GroupByRecordPresenter is using for the background color:

Custom

 

The full style for the GroupByRecordPresenter you can find in the project attached to this blog post.

Please note that this samples uses volume 9.2  The GroupByRecordPresenter style for older versions, for example volume 9.1, is different and will have to be taken from the DefaultStyles directory (~\Program Files (x86)\Infragistics\NetAdvantage for .NET 2009.1\WPF\DefaultStyles).

BackgroundInGroupBy.zip