We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Resizing rows with custom cells

I have a GGC with custom cell types. The custom cells are my own user control that is a list of items that grows/shrinks as the user edits the contents. What's the best way to make the row height adjust as the cell changes height? I tried autosize, but that didn't work. If this needs to be done manually, how should it be done?

1 Reply

HA haneefm Syncfusion Team May 31, 2007 03:59 PM UTC

Hi Tod,

When ResizeToFit method is called with a particular range of cells, Grid calls CellModel.OnQueryPreferredClientSize for all the cells in the range. By default, this method returns the size for the string"style.Text". If you want to resize the custom cell then you need to override a method in the model class called 'OnQueryPrefferedClientSize’. Through this method, you can return the proper size of the cell. The ResizeToFit() method will then use this method to get the correct size of the custom cell. Please try the below code snippet and let me know if this helps.

[c#]
protected override Size OnQueryPrefferedClientSize(Graphics g, int rowIndex, int colIndex, GridStyleInfo style, GridQueryBounds queryBounds)
{
Size s = base.OnQueryPrefferedClientSize (g, rowIndex, colIndex, style, queryBounds);
s.Height += yourHeight;
return s;
}

Also refer the below forum thread for individualized rowheights with grouping grid.
http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=56252

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon