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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to expand the columns of the grid?

Thread ID:

Created:

Updated:

Platform:

Replies:

123706 Apr 13,2016 07:48 AM UTC Apr 15,2016 01:43 PM UTC WinForms 3
loading
Tags: GridGroupingControl
Moises
Asked On April 13, 2016 07:48 AM UTC

Mi grid are this:

And I want to get the next


Piruthiviraj Malaimelraj [Syncfusion]
Replied On April 13, 2016 12:43 PM UTC

Hi Moises,


Thank you for your interest in Syncfusion products.


To set column width to fill the total width of grid,  You can use the AllowProportionalColumnSizing property.

Please refer to the Kb to set column width as client size.


https://www.syncfusion.com/kb/4308/how-to-resize-the-column-width-and-row-height-to-client-size


Code Snippet

this.gridGroupingControl1.AllowProportionalColumnSizing = true;


For more information please refer the below link,


http://syncfusion.com/kb


Regards,

Piruthiviraj


Moises
Replied On April 14, 2016 08:19 AM UTC

If you look at the image, you can see that the Sports column is larger and columns g, s, b, t are smaller.

They are not proportional

In the DatGridView are use then:

AutoSizeColumnsMode: In fill to fit columns


In the next columns modify the properties in design

FillWeight to high that is used for the size of the column

Width the current width of the column

MinimumWidth The minimum column width in pixels



The result are this




Piruthiviraj Malaimelraj [Syncfusion]
Replied On April 15, 2016 01:43 PM UTC

Hi Moises,


Thank you for your update.


Query

Solution









Customizing column widths in GridGroupingControl

Suggestion1

If you want to customize the column width of the grid, you can QueryColWidth event.


Code snippet

this.gridGroupingControl1.TableModel.QueryColWidth += TableModel_QueryColWidth;

void TableModel_QueryColWidth(object sender, GridRowColSizeEventArgs e)

{

  //your customization;

}

Suggestion2

To resize the range of columns or rows to fit the contents of specified range of cells , you can use ResizeToFit method of ColWidths and RowHeights respectively.

Please make use below code.


Code snippet

this.gridGroupingControl1.TableModel.ColWidths.ResizeToFit(GridRangeInfo.Cells(4,5,6,8));


KB

https://www.syncfusion.com/kb/431/how-do-i-resize-the-column-widths-proportionately-when-the-grid-is-resized-in-the-virtual-grid




Regards,

Piruthiviraj.


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

;