This is a migrated thread and some comments may be shown as answers.

How to add Horizontal scroll bar into my ListControl

2 Answers 123 Views
ListControl
This is a migrated thread and some comments may be shown as answers.
dan
Top achievements
Rank 1
dan asked on 11 May 2014, 01:40 PM
I have ListControl with items and although i try all the combination with AutoSizeItems and FitItemsToSize i still cannot see Horizontal scroll bar 

2 Answers, 1 is accepted

Sort by
0
dan
Top achievements
Rank 1
answered on 11 May 2014, 01:56 PM
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
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 14 May 2014, 03:38 PM
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.
 
Tags
ListControl
Asked by
dan
Top achievements
Rank 1
Answers by
dan
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or