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

how to get auto size on dbl click header seperator same as excel?

does anyone know how to get auto size on dbl click header seperator same as in excel?

5 Replies

AD Administrator Syncfusion Team March 8, 2006 11:48 PM UTC

just to be clear at the mo it resizes to the default width...


AD Administrator Syncfusion Team March 9, 2006 07:34 AM UTC

Hi Peterainbow, This can be acheived by using the ResizeToFit method in the ResizingColumns event. Refer to the forum thread for more details. Let us know if you need further assistance. Best regards, Madhan.


AK Adam K. April 17, 2006 01:56 AM UTC

Madhan, This doesn''t seem to work for a Virtual Grid. It only autofits the column header. If a cell in one of the data rows is wider, it doesn''t seem to autofit around that. Any ideas. Thks, ak >Hi Peterainbow, > >This can be acheived by using the ResizeToFit method in the ResizingColumns event. Refer to the forum thread for more details. > >Let us know if you need further assistance. > >Best regards, >Madhan.


AD Administrator Syncfusion Team April 17, 2006 07:20 AM UTC

Hi Adam, In case of a Virtual grid, the column width will be requested and saved by using the QueryColWidth and SaveColWidth event. To resize to the longest text in the column, you can follow the code snippet given below. private void gridControl1_ResizingColumns(object sender, GridResizingColumnsEventArgs e) { if (e.Reason == GridResizeCellsReason.DoubleClick) { GridRangeInfo columns = this.gridControl1.Selections.Ranges.GetRangesContaining(e.Columns).ActiveRange.UnionRange(e.Columns); this.gridControl1.Model.ColWidths.ResizeToFit(columns, GridResizeToFitOptions.IncludeHeaders); e.Cancel = true; } } Thanks for being patience. Best regards, Madhan


AD Administrator Syncfusion Team April 18, 2006 03:47 AM UTC

thks . .worked like a charm !! >Hi Adam, > >In case of a Virtual grid, the column width will be requested and saved by using the QueryColWidth and SaveColWidth event. To resize to the longest text in the column, you can follow the code snippet given below. > >private void gridControl1_ResizingColumns(object sender, GridResizingColumnsEventArgs e) >{ > if (e.Reason == GridResizeCellsReason.DoubleClick) > { > GridRangeInfo columns = this.gridControl1.Selections.Ranges.GetRangesContaining(e.Columns).ActiveRange.UnionRange(e.Columns); > this.gridControl1.Model.ColWidths.ResizeToFit(columns, GridResizeToFitOptions.IncludeHeaders); > e.Cancel = true; > } >} > >Thanks for being patience. > >Best regards, >Madhan >

Loader.
Live Chat Icon For mobile
Up arrow icon