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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Resizing rows with custom cells

Thread ID:





61730 May 31,2007 03:39 PM UTC May 31,2007 03:59 PM UTC WinForms 1
Tags: GridControl
Tod Golding
Asked On May 31, 2007 03:39 PM UTC

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?

haneefm [Syncfusion]
Replied On 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.

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.

Best regards,


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon