How to set GridView row header column width / text alignment

2 posts, 0 answers
  1. Chupacabra
    Chupacabra avatar
    7 posts
    Member since:
    Aug 2012

    Posted 28 Aug 2012 Link to this post

    Hello,

    First, I am starting from this very helpful article: thank you for the recursive solution. VERY helpful: row-header-text

    Next, maybe it was asked, how do we set the width of the row header? And/or text horizontal alignment? And/or position of the editor icon(s)?

    Because while we're getting the row indexing we're looking for, the icons paint over top of that, or vice versa.

    Thank you...

    Best regards.
  2. Svett
    Admin
    Svett avatar
    728 posts

    Posted 30 Aug 2012 Link to this post

    Hi Michael,

    You can change the width of the row header column by setting RowHeaderColumnWidth property of GridTableElement:
    this.radGridView1.TableElement.RowHeaderColumnWidth = 50;

    Then you should use the ViewCellFormatting event to change text-image relation:
    void radGridView1_ViewCellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
    {
        GridRowHeaderCellElement cell = e.CellElement as GridRowHeaderCellElement;
        if (cell != null)
        {
            cell.TextImageRelation = TextImageRelation.ImageBeforeText;
            cell.Text = "1";
        }
    }

    I hope this helps.

    Greetings,

    Svett
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top