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

dbl-click on the header border

I must be missing something obvious. I have a virtual grid, and when I dbl-click on the header border the column sizes to something very defaultish looking - the header text then gets wrapped. Shouldn''t it be looking at the header text and the length of the data in the visible rows? What additional work do I have to do to make that happen? I know about QueryColWidth but don''t understand what the point of it is - it gets fired constantly, even when a mouse moves over a column. Jim

3 Replies

AD Administrator Syncfusion Team October 11, 2005 10:48 PM UTC

In a GridControl, when you double click the border between column headers, the grid reset teh column width to the default column size. If you want sme other behavior, then you can handle the ResizingColumns event. Here is a handler that will do a resizetofit on a double click.
private void gridControl1_ResizingColumns(object sender, GridResizingColumnsEventArgs e)
{
	if(e.Reason.Equals(GridResizeCellsReason.DoubleClick))
	{
		GridRangeInfo range = e.Columns; 
	this.gridControl1.Model.ColWidths.ResizeToFit(range, 
                			GridResizeToFitOptions.IncludeHeaders);
		e.Cancel = true;
	}
}


JI Jim October 11, 2005 10:52 PM UTC

Ok, that looks like what I need, thanks. I just assumed that double-clicking would do a "best fit", but guess that was a bad assumption. :)


JI Jim October 11, 2005 11:36 PM UTC

I optimized a bit: GridRangeInfo range = GridRangeInfo.Cells(0, e.Columns.Left, uiTraceGrid.ViewLayout.LastVisibleRow, e.Columns.Right);

Loader.
Live Chat Icon For mobile
Up arrow icon