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

How to resize column to best fit when double click at column header?

When double click on the line between 2 columns at the column header, the column will resize to a default size. How do I make it such that it will resize to the best fit (longest content in the column ) like in excel? Thanks.

1 Reply

AD Administrator Syncfusion Team August 5, 2005 10:16 AM 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;

Live Chat Icon For mobile
Up arrow icon