Changing UltraGrid header colors

Would anyone be able provide direction or a sample of how to change certain header colors if it is possible? I’ve found how to change rows, cells and summaries but not headers.

Any help would be appreciated!

    // 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;  
    }   

According to Infragistics, there are 2 options :

Turn off SupportTheme - The benefit of this approach is that it is quite simple to do. The drawback is that now the entire grid will be drawn without those great-looking themes.

Leave SupportThemes on but to prevent the column headers from being rendered with the XP themes. The benefit of this approach is that you can carefully select which elements of the grid are to be themed so that the grid does not have to lose its good looks entirely. The drawback is that the implementation is (ever so slightly) more complicated.
2 Likes

Does this make it bold or just change color. I ask as I am not able to get grid header to be bold.

Short answer:

Slightly longer answer:

EpiUltraGrid ultraGrid1 = (EpiUltraGrid)csm.GetNativeControlReference("86fb7bf3-f52e-4d9a-9d96-30551ee51ecf");
		ultraGrid1.UseOsThemes = Infragistics.Win.DefaultableBoolean.False; //True;   //either works, but setting this to false kills ALL of the theme on this control.
		int colCount = 0;
	    foreach(var col in 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;
 	       col.Header.Appearance.ForeColor = Color.Red;
			if(colCount++ % 2 == 0)
			{
				//col.Header.Appearance.FontData.SizeInPoints = 18;  //want a bigger difference?
				col.Header.Appearance.FontData.Bold =  Infragistics.Win.DefaultableBoolean.True;
				col.Header.Caption = "Yep";			
		    }   
		}
2 Likes