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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Stop Grid from shrinking

Thread ID:

Created:

Updated:

Platform:

Replies:

14279 May 24,2004 12:55 PM UTC May 24,2004 06:56 PM UTC WinForms 3
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On May 24, 2004 12:55 PM UTC

How do you stop a grid control from shrinking to fit the data. I have a grid with say only three rows of data and I want it to still fill the whole space it was given in the designer, what property do I have to set so it will.

Administrator [Syncfusion]
Replied On May 24, 2004 03:01 PM UTC

Currently, there is no property that will give you this behavior. But you can handle an event, Model.QueryColWidth and provide the colwidths dynamically there.
this.gridDataBoundGrid1.Model.QueryColWidth += new GridRowColSizeEventHandler(grid_QueryColWidth);

private void grid_QueryColWidth(object sender, GridRowColSizeEventArgs e)
{
	if(e.Index == this.gridDataBoundGrid1.Model.ColCount)
	{
		e.Size = this.gridDataBoundGrid1.ClientSize.Width - this.gridDataBoundGrid1.Model.ColWidths.GetTotal(0, this.gridDataBoundGrid1.Model.ColCount-1);
		e.Handled = true;
	}
} 

Administrator [Syncfusion]
Replied On May 24, 2004 04:49 PM UTC

That doesn''t help with the height of the control. My main problem is I have a bunch of grids on a form all lined up nice and neat (with enough room to hold 15+ rows), however when there is a grid that only has 3 rows it makes the form look out of sync since the control gets shrunk.

Administrator [Syncfusion]
Replied On May 24, 2004 06:56 PM UTC

I am sorry, I misread and thought you wanted to expand columns to fill the clientarea. You can have the grid display empty rows by setting this.gridControl1.Model.Options.DisplayEmptyRows = true; Or, you can use the code above (with the right column switch for the last row and ColWidths switched to RowHeights to have a single big row at the bottom.

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

;