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

How to change the font in gridCell to bold.

Hello,

I would like to change the font in the one row to bold.
I used:

```
public void SfDataGridOnQueryRowStyle(object sender, QueryRowStyleEventArgs e)
        {
               (...)
            e.Style.BackgroundColor =  Color.WhiteSmoke;
            e.Style.ForegroundColor = Color.White;
            e.Handled = true;
        }
```

but in the style properties I have only the foreground and background colors.
How can I define a new style for font bold?

Rgds,
BK

6 Replies

SP Subburaj Pandian Veluchamy Syncfusion Team July 1, 2019 11:27 AM UTC

Hi Bartosz, 
 
Thank you for contacting Syncfusion support. 
 
Your requirement of Customizing Grid cell Font can be achieved using QueryCellStyle event in DataGrid. In that you can use FontAttribute of Style to customize the same. You can customize the row based on requirement applying condition with Grid cell, 
 
[C#] 
dataGrid.QueryCellStyle += DataGrid_QueryCellStyle; 
 
private void DataGrid_QueryCellStyle(object sender, QueryCellStyleEventArgs e) 
{ 
     e.Style.FontAttribute = FontAttributes.Bold; 
} 
 
But there is an issue with this property, that we have already found and fixed the issue internally from our end. This issue fix will be included in our upcoming 2019 Volume 2 main release which is expected to be available by mid of this month July 2019. We appreciate your patience until then. 
  
Regards,
Subburaj Pandian V  



BK Bartosz Kleszcz July 1, 2019 12:09 PM UTC

Hi,
Thank you for the solution


I didn't know that I can get the RowIndex property from QueryCellStyleEventArgs.
Thank you for help.

Rgds,
BK


SP Subburaj Pandian Veluchamy Syncfusion Team July 1, 2019 12:19 PM UTC

Hi Bartosz,  
  
Thank you for the update. 
 
Yes, you can use either RowIndex and RowData as well. As mentioned, we will include the issue fix in our Volume 2 release and let you know once it has been rolled out. We appreciate your patience until then. 
 
Regards,
Subburaj Pandian V  



BK Bartosz Kleszcz July 2, 2019 04:45 PM UTC

On the android platform, the bold font works correctly:

e.Style.FontAttribute = FontAttributes.Bold;

but on iOS does not work. Is this the error you were writing about and
will be fix in July?



SP Subburaj Pandian Veluchamy Syncfusion Team July 3, 2019 09:09 AM UTC

Hi Bartosz,   
   
Thank you for the update.  
  
Yes, we have mentioned the same issue. In Android, it is working because of LoadUIView default value is false as default. As we mentioned, we will include this issue fix in our Volume 2 main release and let you know once it has been rolled out. We appreciate your patience until then.  
  
Regards,
Subburaj Pandian V   



SP Subburaj Pandian Veluchamy Syncfusion Team July 12, 2019 07:22 AM UTC

Hi Bartosz, 
  
We are glad to announce that our Essential Studio 2019 Volume 2 Release version 17.2.0.34 is rolled out with the reported issue fix and is available for download under the following link. 
  
 
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance. 
  
Regards,
Subburaj Pandian V 


Loader.
Live Chat Icon For mobile
Up arrow icon