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
close icon

Autofit by doubleclicking right side of header row . .

In excel if i double click on the right side of the header row in a column, it autofits for the entire column. with syncfusion it seems to only autofit the header row and ignore the rest of the rows in that column. Is there a way to mimic the excel behavior. thks, ak

1 Reply

AD Administrator Syncfusion Team December 5, 2005 05:59 PM UTC

The default behavior is to restrict the resizing to the visible grid for performance reasons. If you want to remove this restrictions, you can subscribe to teh ResizingColumsn event and do the resizing yourself. If you want the doubleclick to behave differently, you can handle this event.
private void grid_ResizingColumns(object sender, GridResizingColumnsEventArgs e)
{
	if(e.Reason.Equals(GridResizeCellsReason.DoubleClick))
	{
		GridRangeInfo range = e.Columns; 
	this.grid.Model.ColWidths.ResizeToFit(range, 
                			GridResizeToFitOptions.IncludeHeaders);
		e.Cancel = true;
	}
}

Loader.
Live Chat Icon For mobile
Up arrow icon