Automatically resize row based on content?

Posted by: marc.brown on 20 September 2017, 5:52 am EST

    • Post Options:
    • Link

    Posted 20 September 2017, 5:52 am EST

    I have a grid that has some columns that display multi-line text. What do I need to do in order to cause each row to resize to display all lines of text? For example, if I have a row with a cell that has three lines of text in it, I want that row (only) to be tall enough to show all three lines of text. If the next row only has one line of text in its multi-line cell, I want it to be tall enough for one line, and so forth.

  • Posted 21 September 2017, 7:56 pm EST

    Hi Marc,

    C1FlexGrid provides a method AutoSizeRow which resizes a row to fit its visible contents:

    http://help.grapecity.com/componentone/NetHelp/c1flexgridwpfsilv/C1.WPF.FlexGrid.4~C1.WPF.FlexGrid.C1FlexGrid~AutoSizeRow.html

    You can use the same for resizing the row of your choice.

    
    this.FlexGrid.AutoSizeRow(rowIndex, extraHeight);
    
    

    Thanks,

    Pragati

  • Posted 26 September 2017, 11:17 pm EST

    My apologies. I see I failed to specify which grid I was using. I’m not using the flex grid, I’m using the C1DataGrid.

  • Posted 27 September 2017, 5:22 pm EST

    Hi,

    In order to autosize the rows in C1DataGrid, you can set its RowHeight property to “Auto”. In this case, the height of the row will be determined by the content of the cells of each row as desired.

    Please refer the following documentation link for more information on this:

    http://help.grapecity.com/componentone/NetHelp/c1datagridwpf/C1.Silverlight.DataGrid.5~C1.Silverlight.DataGrid.C1DataGrid~RowHeight.html

    Thanks,

    Pragati

  • Posted 8 November 2017, 6:52 am EST

    Thanks!

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels