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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Resizing rows with custom cells

Thread ID:

Created:

Updated:

Platform:

Replies:

61730 May 31,2007 03:39 PM UTC May 31,2007 03:59 PM UTC Windows Forms 1
loading
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.

[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

CONFIRMATION

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.

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

;