This is a migrated thread and some comments may be shown as answers.

Row Height and Font Size

5 Answers 1602 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Nebojsa Mancic
Top achievements
Rank 2
Nebojsa Mancic asked on 04 Jul 2010, 11:30 AM
I am new to GridView control, and I have noticed something strange to me. When I have set Font size of GridView control,  Row height and Header height did not changed and in one row I can see only part of data in Row. I thought that it should change Row height automaticaly to Font size ?

5 Answers, 1 is accepted

Sort by
0
frida
Top achievements
Rank 1
answered on 05 Jul 2010, 05:52 AM
Set the auto size columns mode on fill by this code in the page_load event:
this
.GridView1.MasterGridViewTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
it can set your columns size fit by your data
i wish your problem solved.
you can see the MasterGridViewTemplate property also.
--@Frida--@

 

0
Accepted
Alexander
Telerik team
answered on 05 Jul 2010, 04:58 PM
Hello Nebojsa,

Thank you for your question.

You can set the height of the RadGridView rows and header row using the GridElement property:

this.radGridView1.GridElement.TableHeaderHeight = 100;
this.radGridView1.GridElement.RowHeight = 100;

Another approach is to use the AutoSizeRows option. This mode is only appropriate if you use the CellFormatting event to set the font of the RadGridView elements. For example if you wish to change the font of the rows and the header row, you can use:

this.radGridView1.AutoSizeRows = true;
 
Font f = new Font(new FontFamily("Arial"), 24.0f);
private void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
    e.CellElement.Font = f;
}

I hope it helps.

All the best,
Alexander
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Nebojsa Mancic
Top achievements
Rank 2
answered on 05 Jul 2010, 09:28 PM
Thanks Alexander, second snippet has solved my problem. But I think that you should solve this automaticaly.
0
msulis
Top achievements
Rank 1
answered on 13 Dec 2010, 07:33 AM
Wait do I understand correctly that I can NOT set the font of the RadGridView header cells at design time?
0
Alexander
Telerik team
answered on 15 Dec 2010, 04:01 PM
Hello Msulis,

Yes, you understand correctly. RadGridView uses virtualization for its cell elements and visual settings cannot be applied directly to cells at design-time.

The font of the RadGridView header cells is defined in the theme you use. You can modify it using the Visual Style Builder. You can also change the font in runtime using the formatting events.
 
I hope it helps.

Best regards,
Alexander
the Telerik team
Get started with RadControls for WinForms with numerous videos and detailed documentation.
Tags
GridView
Asked by
Nebojsa Mancic
Top achievements
Rank 2
Answers by
frida
Top achievements
Rank 1
Alexander
Telerik team
Nebojsa Mancic
Top achievements
Rank 2
msulis
Top achievements
Rank 1
Share this question
or