Column Stretch to Fill

4 posts, 0 answers
  1. Curtis
    Curtis avatar
    73 posts
    Member since:
    Oct 2014

    Posted 06 Feb 2018 Link to this post

    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

  2. Dimitar
    Admin
    Dimitar avatar
    2931 posts

    Posted 07 Feb 2018 Link to this post

    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.
  3. Curtis
    Curtis avatar
    73 posts
    Member since:
    Oct 2014

    Posted 08 Feb 2018 in reply to Dimitar Link to this post

    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!

  4. Dimitar
    Admin
    Dimitar avatar
    2931 posts

    Posted 09 Feb 2018 Link to this post

    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.
Back to Top