How to set a Grid header format

It seems to be a simple thing, but I cannot get it working... I need to change a default font of the headers (i.e. row 0 and column 0) to normal, not bold.

This code works:
Me.GridControl2(0, 1).Font.Bold = False

But this one doesn't:
Me.GridControl2.Model.ColStyles(0).Font.Bold = False
Me.GridControl2.Model.RowStyles(0).Font.Bold = False

How can I define a custom font for the whole header row or column? It is not a good idea to loop through all cells...

Thanks

9 Replies

AK Arun Kumar V Syncfusion Team February 27, 2013 11:20 AM UTC

Hi Andy Garu,

Thanks for your interest in Syncfusion products.

Query:

How can I define a custom font for the whole header row or column?

I could not able to reproduce the reported code doesnot respond to the particular column font. The code specified from your side itself can make the font of the particular column to be bold.  Please refer to the following image.

I have provided the sample in latest Syncfusion version so it might cause problems if you use older version due to unavailability of advanced support provided in latest version. So please provide me the version you are using, so that I can provide sample in that version.

Please let me know if you have any other concerns.

Regards,

Arun.



VB_b3b19831.zip


AG Andy Grau February 28, 2013 12:34 AM UTC

Thank you, but it doesn't work. Can you provide a sample for the 7.3 version?


AK Arun Kumar V Syncfusion Team February 28, 2013 10:26 AM UTC

Hi Andy Grau,

Thanks for the update.

Query:

sample for the 7.3 versionsample for the 7.3 version

 

I have modified the sample in the 7.3 version, as I said in my last update the below code given itself will make the font to appear as bold for particular columns text.

 

Me.gridControl1.Model.ColStyles(1).Font.Bold = True            Me.gridControl1.Model.ColStyles(2).Font.Bold = True

 

Snap:

 

Please refer to the following sample and let me know if the it help. If the issue is not solved Please give me a sample file to reproduce the reported behavior.

 

Please let me know if you have any other concerns.

Regards,

Arun.



VB_5f6daf11.zip


AG Andy Grau March 3, 2013 11:22 PM UTC

Yes, it works for any columns/rows except headers, i.e. column 0 and row 0. How can I set it up for column 0 or row 0?

Thanks


AK Arun Kumar V Syncfusion Team March 4, 2013 12:16 PM UTC

Hi Andy,

Thanks for the update.

Yes I could able to reproduce the reported in your version. So to set the header text font to bold you can handle the PrepareViewStyleInfo event.

this.gridControl1.PrepareViewStyleInfo +=

Please let me know if you have any other concerns.

Regards,

Arun.



AG Andy Grau March 5, 2013 07:52 AM UTC

Thanks, could you please provide the complete code for VB.NET?

Also, for the code optimization, would it be better just to loop through all header's cells rather than handle events?

Thanks


AK Arun Kumar V Syncfusion Team March 5, 2013 12:03 PM UTC

Hi Andy,

Thanks for the update.

Here is the codesnippet for the reported behavior in VB.

Code Snippet:

Private Sub grid_PrepareViewStyleInfo(ByVal sender As Object, ByVal e As GridPrepareViewStyleInfoEventArgs)

if e.Style.CellType == GridCellTypeName.Header Then

e.Style.Font.Bold = true

End If

Please use the above code making the header text to be bold, and let me know if you have any other concerns.

Regards,

Arun.



AG Andy Grau March 6, 2013 08:41 AM UTC

Thank you, Arun. It works fine.


AK Arun Kumar V Syncfusion Team March 6, 2013 08:44 AM UTC

Hi Andy,

Thanks for the update.

We are glad to hear that the reported issue is solved in your side. If you have any other queries please create any new Incident/Forum.

Regards,

Arun.


Loader.
Up arrow icon