How to get Columns to AutoSize FILL in RadListView

8 posts, 0 answers
  1. Mark
    Mark avatar
    89 posts
    Member since:
    Oct 2014

    Posted 02 Nov 2017 Link to this post

    Have a list view with multiple columns.  Is there a way to get the columns to AutoSize similar to a RadGridView of "FILL".  I have not found anything yet.  

     

    Thanks for the help.

  2. Jhon
    Jhon avatar
    18 posts
    Member since:
    Jun 2017

    Posted 02 Nov 2017 in reply to Mark Link to this post

    Estimated mark,
    Use the bestfit property of the columns.

    column.columns (i) .bestfit()


    regards
  3. Jhon
    Jhon avatar
    18 posts
    Member since:
    Jun 2017

    Posted 02 Nov 2017 in reply to Mark Link to this post

    foreach (ListViewDetailColumn c in this.radListView1.Columns)
        {
            c.BestFit();
        }
  4. Jhon
    Jhon avatar
    18 posts
    Member since:
    Jun 2017

    Posted 02 Nov 2017 in reply to Mark Link to this post

    foreach (ListViewDetailColumn c in this.radListView1.Columns)
        {
            c.BestFit();
        }
  5. Dimitar
    Admin
    Dimitar avatar
    2312 posts

    Posted 03 Nov 2017 Link to this post

    Hi Mark,

    This functionality is not available in RadListView, however, you can easily implement a similar one. For example, you can use the Resize event to set the column width:
    private void RadListView1_Resize(object sender, EventArgs e)
    {
        int columnWidth = radListView1.Width / radListView1.Columns.Count;
        foreach (var item in radListView1.Columns)
        {
            item.Width = columnWidth;
        }
    }

    I hope this will be useful. 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.
  6. Mark
    Mark avatar
    89 posts
    Member since:
    Oct 2014

    Posted 03 Nov 2017 Link to this post

    Yes, I know about BestFit(), but this doesn't do what I want it to.  I have my columns set to a specified min width size. So, these columns will fit perfectly when the form is set to it min size.  When I resize the form, my control resizes as well, however, unlike a GRID's columns that has an AutoSizeMode.FILL, which will resize the columns so they fill the control (no dead space on the right side of the control).  However, as I discovered and Dimitar pointed out, this functionality doesn't exists for a ListBox control. Yes, BestFit will resize the columns based on the AutoSizeMode of the control (which can be based on the header, cell contents, both or none), it will not FILL the control, therefor, leaving ugly dead space in the control.   I believe Dimitar's solution will work. I am going to try that out.

  7. KKL
    KKL avatar
    17 posts
    Member since:
    Nov 2016

    Posted 13 Feb in reply to Mark Link to this post

    Hi, Mark. I know this is probably a bit late, but I'd encourage you (and anyone else keen for this functionality) to keep tabs on this feedback item. Hopefully if more interest is shown this property will be added soon. 
  8. Dimitar
    Admin
    Dimitar avatar
    2312 posts

    Posted 13 Feb Link to this post

    Hi,

    Yes, voting for a particluar item will increase its priority. However, I cannot provide a timeframe for this one. Please follow the item and you will be notified when its status changes. 

    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