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 expand the columns of the grid?

Mi grid are this:

And I want to get the next


3 Replies

PM Piruthiviraj Malaimelraj Syncfusion Team 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,


https://syncfusion.com/kb


Regards,

Piruthiviraj



MO Moises 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





PM Piruthiviraj Malaimelraj Syncfusion Team 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.


Loader.
Live Chat Icon For mobile
Up arrow icon