This is a migrated thread and some comments may be shown as answers.
Column Stretch to Fill
3 Answers 80 Views
This is a migrated thread and some comments may be shown as answers.
Curtis
Top achievements
Rank 1
Curtis asked on 07 Feb 2018, 01:40 AM

Hi folks :)

Is there any way to tell a specific column inside a grid to "Stretch to Fill" so it completely fills the leftover space in a grid where the column widths added up do not equal the total width of the grid control?

 

Hard to describe so out comes Photoshop so I can create a couple of images to demonstrate what I'm talking about:

The first image shows the grid "as-is" the second images shows the effect I'm looking for:  The "Description" column would stretch to fill all remaining space.

 

Any help would be very much appreciated!

-Curtis

3 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 07 Feb 2018, 07:52 AM
Hello Curtis,

You can set the AutoSizeColumnsMode to fill. Then you can set the Max/Min width of all columns except the last one. Here is an example:
radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
for (int i = 0; i < radGridView1.Columns.Count - 1 ; i++)
{
    radGridView1.Columns[i].MaxWidth = 100;
    radGridView1.Columns[i].MinWidth = 100;
}

Let me know if you have additional questions.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Curtis
Top achievements
Rank 1
answered on 08 Feb 2018, 08:39 PM

Thank you Dimitar :)

This isn't quite what I had in mind - but does show me how to write my own method to handle this which was great :)

Thanks again!

0
Dimitar
Telerik team
answered on 09 Feb 2018, 11:57 AM
Hello Curtis,

I am glad that you have found a solution for your case. Do not hesitate to contact us if you have other questions.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Asked by
Curtis
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Curtis
Top achievements
Rank 1
Share this question
or