HtmlViewDefinition Header Row Height

4 posts, 0 answers
  1. Mark
    Mark avatar
    32 posts
    Member since:
    Jan 2012

    Posted 19 Feb Link to this post

    Hi,

    I have a HtmlViewDefinition that is added to a grid so as to provide detail information for a row, similar to your example in http://www.telerik.com/help/winforms/gridview-overview.html except I only have a single row defined in the HtmlViewDefinition

    This works OK, but I need to enable column headers which I do by setting 

    template.ShowColumnHeaders = True

    and then for each column setting

    template.Columns(column.FieldName).HeaderText

    This seems to enable the headers OK and they are displayed but I have a problem with the header row height. It appears to consume the entire row height for the HtmlViewDefinition.RowTemplate.Row I have added and I can't find a way to modify it.

    Is there a way to change the header row height?

    Thanks,

    Mark.

     

     

  2. Hristo
    Admin
    Hristo avatar
    716 posts

    Posted 19 Feb Link to this post

    Hi Mark,

    Thank you for writing.

    You can adjust the height of the rows part of you view definition by directly accessing it in the RowTemplate:
    HtmlViewDefinition viewDef = new HtmlViewDefinition();
    // ...
    viewDef.RowTemplate.Rows[0].Height = 150;

    My suggestion is that you leave it with its default size and let it arrange itself according to the defined cell definition. Then you can handle the RowForamtting event and change the height of the actual data row to a value of your choice: 
    private void radGridView1_RowFormatting(object sender, RowFormattingEventArgs e)
    {
        GridDataRowElement rowElement = e.RowElement as GridDataRowElement;
        if (rowElement !=  null && e.RowElement.RowInfo.HierarchyLevel == 1)
        {
            e.RowElement.RowInfo.Height = 250;
        }
    }

    I am also sending you a gif file showing the result on my end.

    I hope this helps. Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo Merdjanov
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Mark
    Mark avatar
    32 posts
    Member since:
    Jan 2012

    Posted 22 Feb in reply to Hristo Link to this post

    Hi,

    This has helped tremendously. The way I have actually managed to resolve this is in RowFormatting as suggested,

     

    I've added :

    If TypeOf e.RowElement Is GridTableHeaderRowElement Then CType(e.RowElement, GridTableHeaderRowElement).RowInfo.Height = 23

    And this sets the header height correctly.

    Many thanks for your help.

     

  5. Hristo
    Admin
    Hristo avatar
    716 posts

    Posted 22 Feb Link to this post

    Hi Mark,

    Thank you for writing back.

    I am glad that I managed to help. Indeed, the addition you have made would specify explicitly the height of the header row.

    Please let me know if I can assist you any further.

    Regards,
    Hristo Merdjanov
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
Back to Top