The UltraWinGrid column headers SupportThemes property is set to True by default. This setting allows the grid to let the operating system draw certain aspects of the control with an XP theme. If you try to set the column headers of the grid to a custom color, they will be ignored.
There are two options for disabling the themed rendering, in turn, enabling the custom header colors to be drawn.
Below is a sample of the two ways to go about solving this problem.
// One way to allow the column headers to show custom colors is to disallow the grid // to use XP themes at all. // this.ultraGrid1.SupportThemes = false; // // A more surgical approach would be to allow the grid to support XP themes, but to // disable themes just for the column headers. // this.ultraGrid1.SupportThemes = true; foreach( UltraGridColumn col in this.ultraGrid1.DisplayLayout.Bands[0].Columns ) { // Here we "turn off" theming for the column header. col.Header.Appearance.ThemedElementAlpha = Infragistics.Win.Alpha.Transparent; col.Header.Appearance.BackColor = Color.Azure; col.Header.Appearance.BackColorDisabled = Color.Orange; }
' One way to allow the column headers to show custom colors is to disallow the grid ' to use XP themes at all. ' Me.ultraGrid1.SupportThemes = False ' ' A more surgical approach would be to allow the grid to support XP themes, but to ' disable themes just for the column headers. ' Me.ultraGrid1.SupportThemes = True Dim col As UltraGridColumn For Each col In Me.ultraGrid1.DisplayLayout.Bands(0).Columns ' Here we "turn off" theming for the column header. col.Header.Appearance.ThemedElementAlpha = Infragistics.Win.Alpha.Transparent col.Header.Appearance.BackColor = Color.Azure col.Header.Appearance.BackColorDisabled = Color.Orange Next