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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridGroupingControl sizing

Thread ID:

Created:

Updated:

Platform:

Replies:

18671 Sep 7,2004 11:27 AM UTC Sep 7,2004 12:17 PM UTC WinForms 1
loading
Tags: GridControl
Mike Woolley
Asked On September 7, 2004 11:27 AM UTC

I have a GGC in a user control, docked to Fill. I''d like to be able to expand the last column of the grid to fit the width of the user control without showing a horizontal scrollbar only if the grid doesn''t fill the entire width when I bind to my datasource. If the total column widths equals or exceeds the width of the grid control, then behave as normal. Any ideas how to do this? I''ve tried several things without success...

Administrator [Syncfusion]
Replied On September 7, 2004 12:17 PM UTC

Hi Mike, You can handle the QueryColWidth event of the TableModel as follows and also set SmoothControlResize = false. this.gridGroupingControl1.TableModel.QueryColWidth += new GridRowColSizeEventHandler(TableModel_QueryColWidth); this.gridGroupingControl1.TableModel.Options.SmoothControlResize = false; bool fillLastColumn = true; private void TableModel_QueryColWidth(object sender, GridRowColSizeEventArgs e) { GridTableModel gridModel = sender as GridTableModel; GridTableControl grid = (GridTableControl) gridModel.ActiveGridView; if (gridModel != null && grid != null) { int lastColIndex = gridModel.ColCount-2; // GridTableModel always has one two empty extra column at end if (this.fillLastColumn && e.Index == lastColIndex) { int width = gridModel.ColCount <= 0 ? 0 : gridModel.ColWidths.GetTotal(0, lastColIndex-1); e.Size = grid.ClientRectangle.Width-width; e.Handled = true; } } } I attached a sample project. AutoFillLastColumn_5112.zip Stefan

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;