SummaryRowGroupHeaders Propertys

4 posts, 0 answers
  1. Veda
    Veda avatar
    5 posts
    Member since:
    Jan 2013

    Posted 22 Jan 2013 Link to this post

    How to set font styles with colors while grouping Grid View Rows??
  2. Jack
    Admin
    Jack avatar
    2333 posts

    Posted 23 Jan 2013 Link to this post

    Hi Veda,

    Thank you for writing.

    You can customize the group header appearance by handling the ViewCellFormatting event. You should modify GridGroupContentCellElement properties in this case:
    void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
    {
        GridGroupContentCellElement contentCell = e.CellElement as GridGroupContentCellElement;
        if (contentCell != null)
        {
            if (font == null)
            {
                font = new Font("Comic Sans MS", 12, FontStyle.Regular);
            }
            contentCell.Font = font;
            contentCell.ForeColor = Color.Red;
        }
    }

    You may also want to change how specific text parts look. The easiest way to do this is by handling GroupSummaryEvaluate event and use our html like syntax:
    void radGridView1_GroupSummaryEvaluate(object sender, GroupSummaryEvaluationEventArgs e)
    {
        if (e.Context is GridViewGroupRowInfo)
        {
            e.FormatString = "<html><b>{0}:</b><font='Courier MS'><color=green><i>{1}</i>";
        }
    }

    To enable this feature on you should set the DisableHTMLRendering property to false when handling ViewCellFormatting event:
    void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
    {
        GridGroupContentCellElement contentCell = e.CellElement as GridGroupContentCellElement;
        if (contentCell != null)
        {
            contentCell.DisableHTMLRendering = false;
        }
    }

    I hope this helps.
     
    All the best,
    Jack
    the Telerik team
    Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
  3. Roger
    Roger avatar
    6 posts
    Member since:
    Jul 2012

    Posted 23 Mar 2013 Link to this post


    Hi coders

    to get the font to display correctly I had to remove the single quotes. My font name was a single word, eg Arial. Not sure what would happen if there was a space in the font name - as in the example. Maybe then the single quotes would be necessary. Here's the corrected, working (for me) code

     "<html><b>{0}:</b><font=Arial><color=green><i>{1}</i>";

    I hope this helps someone.

    Useful code as I needed it to change the group font at {1}

    
    Roger


  4. Jack
    Admin
    Jack avatar
    2333 posts

    Posted 27 Mar 2013 Link to this post

    Hi Roger,

    Yes, your solution is correct. Presently there is an issue when the font name is surrounded with single quotes. I logged the issue in our issue tracking system and we will address it in one of our upcoming releases. Use this link to track the issue status. I updated your Telerik points for this report. 
     
    Greetings,
    Jack
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
Back to Top