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

Autosizing columns

Are there any events raised, other than ColWidthsChanged, when the user double-clicks on the divider between columns to resize the column? Thanks!

4 Replies

AD Administrator Syncfusion Team February 19, 2003 08:04 PM UTC

See ResizingColumns. It is called for hittesting for that line, when pressing the mouse and dragging the sizing line. Stefan

TF Terry Foster May 13, 2003 06:31 PM UTC

I have noticed that the default behavior for double clicking the column divider (GridControl) is to set the size of the column to the 'DefaultColWidth' property of the grid. This seems a little strange as all other grids I've worked with size it to the longest text in any of the cells of the column. Is there an option to change the behavior of the double click to do this? If not, what would be the best way to implement this? Thanks, Terry

AD Administrator Syncfusion Team May 13, 2003 07:31 PM UTC

There is no property that does this, but you can do it handling the ResizingCols event.
private void gridControl1_ResizingColumns(object sender, GridResizingColumnsEventArgs e)
	if(e.Reason == GridResizeCellsReason.DoubleClick)
		this.gridControl1.ColWidths.ResizeToFit(e.Columns, GridResizeToFitOptions.IncludeHeaders);
		e.Cancel = true;

TF Terry Foster May 14, 2003 10:27 AM UTC

Perfect - thank you. Terry

Live Chat Icon For mobile
Up arrow icon