We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Changing the Background and Font Color of the Grouped Column

How to Change the Background and Font Color of the Grouped Column on SfDataGrid? 

The Default Background Color is Gray and I want to remove the Bold from the Font.

Is that possible?




1 Reply

SK Shivagurunathan Kamalakannan Syncfusion Team August 29, 2019 10:48 AM UTC

Hi Cezar,   
   
Thank you for contacting Syncfusion Support.   
   
Your requirement to customize the Caption summary row can be achieved by overriding the OnInitializeDisplayView() method. You can also customize the default background color, text color and font attributes for the caption summary row based on your requirement.   
   
Pease refer the below code snippet.   


  
 
public partial class MainPage : ContentPage   
{   
               public MainPage()   
               {   
                              InitializeComponent();   
                              dataGrid.CellRenderers.Remove("CaptionSummary");   
                              dataGrid.CellRenderers.Add("CaptionSummary", new CustomGroupRenderer());   
               }                                
}   
public class CustomGroupRenderer : GridCaptionSummaryCellRenderer   
{   
               public CustomGroupRenderer()   
               {   
               }   
               public override void OnInitializeDisplayView(DataColumnBase dataColumn, SfLabel view)   
               {   
                              base.OnInitializeDisplayView(dataColumn, view);   
                              view.FontAttributes = FontAttributes.None;   
                              view.BackgroundColor = Color.Tomato;   
                              view.TextColor = Color.White;   
               }   
}   


  
 
    
We have prepared a sample based on your requirement and it can be downloaded from the below link.   
 
Please get back to us if you require further assistance from us.  
 
Regards,   
Shivagurunathan  


Loader.
Live Chat Icon For mobile
Up arrow icon