How to add Horizontal scroll bar into my ListControl

3 posts, 0 answers
  1. dan
    dan avatar
    4 posts
    Member since:
    May 2014

    Posted 11 May 2014 Link to this post

    I have ListControl with items and although i try all the combination with AutoSizeItems and FitItemsToSize i still cannot see Horizontal scroll bar 
  2. dan
    dan avatar
    4 posts
    Member since:
    May 2014

    Posted 11 May 2014 in reply to dan Link to this post

    Update:

    I am using this:

                    radListControlFiles.FitItemsToSize = false;
                    radListControlFiles.AutoSizeItems = true;

    and it works but only if added more than 1 file, after added 1 file i cannot see the Horizontal scroll bar
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 14 May 2014 Link to this post

    Hello Dan,

    Thank you for writing.

    It is necessary to set the FitItemSize property to false and the AutoSizeItem property to true in order to display the horizontal scroll bar, when the available space is not enough to display the whole items' content, as you did. However, you need to have items in the RadListControl by which to calculate correctly the horizontal scroll bar range. That is why I would recommend you to set the FitItemsToSize and the AutoSizeItems properties after you add the desired items as the scroll bar range is calculated according to the currently available items when you set the mentioned properties.
    public Form1()
    {
        InitializeComponent();
        for (int i = 0; i < 10; i++)
        {
            this.radListControl1.Items.Add("Item" + DateTime.Now.AddDays(i).ToLongDateString());
        }
        this.radListControl1.FitItemsToSize = false;
        this.radListControl1.AutoSizeItems = true;
    }
     
    private void radButton1_Click(object sender, EventArgs e)
    {
        this.radListControl1.Items.Add("Item" + DateTime.Now.ToLongDateString() +
                                       DateTime.Now.ToLongDateString() +
                                       DateTime.Now.ToLongDateString() +
                                       DateTime.Now.ToLongDateString());
       
        this.radListControl1.FitItemsToSize = false;
        this.radListControl1.AutoSizeItems = true;
    }

    I hope this information helps. Should you have further questions, I would be glad to help.

    Regards,
    Desislava
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top