Grid font is too small

2 posts, 1 answers
  1. Michael
    Michael avatar
    33 posts
    Member since:
    Mar 2009

    Posted 21 Apr 2009 Link to this post

    I'm finding that the Grid doesn't use the font of its parent for the column headers and cells.  Is there a way to cause it to do so?
  2. Answer
    Mike avatar
    640 posts

    Posted 22 Apr 2009 Link to this post

    Hi Michael,

    Generally any Font setting in a RadControl can be defined through theme. This breaks the inheritance with any of the Parent RadElement and eventually Control's parent. Note that RadElements support property value inheritance for some properties like Font, ForeColor, BackColor. This feature resembles controls' ambient properties. RootElement inherits its properties from the corresponding RadControl properties. In the case of RadGridView, header cell's Font would not inherit any values, since it is set through theme.

    You can test where any property of any RadElement gets its value from, using RadControlSpy, by right-clicking the property name in the property grid:

    RadControl Spy

    The easiest solution in the case wth RadGridView header (or any other cells) would be to set the Font you need in the ViewCellFormatiing event:
    private void radGridView1_ViewCellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e) 
        if (e.CellElement is GridHeaderCellElement) 
            e.CellElement.Font = this.Font; 
    (assuming "this" is the form).

    If the you need the font to change dynamically (if form's font changes) you should though update the header row:

    I have attached a sample that demonstrates the approach:

    demo application

    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top