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

Font Size in GridView

1 Answer 326 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Nicky
Top achievements
Rank 1
Nicky asked on 29 Oct 2007, 10:19 PM
Hi Telerik,

I need to reduce fontsize of contents in RadGridView from property box
I dont see any property there ? please provide solution.


Thanks
Sushil

1 Answer, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 30 Oct 2007, 03:33 PM
Hi Nicky,

Thank you for the question.

The visual look of the RadGridView is controlled by the TPF theming engine and it is preferred to set the Font property through theme in the Visual Style Builder. This can also be done through code. For example, you can set a different Font, based on some condition inside the CellFormatting event.

Refer to the code block below:

this.radGridView1.CellFormatting += new CellFormattingEventHandler(radGridView1_CellFormatting); 
 
void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e) 
    if (e.CellElement.ColumnInfo is GridViewDataColumn) 
    { 
        if ((e.CellElement.ColumnInfo as GridViewDataColumn).DataField == "Price" && 
            (float)e.CellElement.Value > 10.5f) 
        { 
            e.CellElement.Font = new Font("MS Sans Serif", FontStyle.Italic); 
        } 
    } 
 

Don't hesitate to contact us if you have other questions.

Regards,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
GridView
Asked by
Nicky
Top achievements
Rank 1
Answers by
Jack
Telerik team
Share this question
or