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

Automatically Scroll to the last Item in ListBox

1 Answer 3996 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
ITA
Top achievements
Rank 1
ITA asked on 10 Sep 2014, 09:29 AM
Hi,

i have a little application running as trayicon. Here i use a RadListBox to add some informations for the user.

In my code behind:
var item1 = new RadListBoxItem() { Content = "Start Sync" +  Convert.ToString(i)};
results.Items.Add(item1);

works fine. But how do i scroll down to the latest added item in my ListBox?

Thanks a lot, best Regards
Rene

1 Answer, 1 is accepted

Sort by
0
Kalin
Telerik team
answered on 10 Sep 2014, 11:20 AM
Hi Rene,

In order to scroll the ListBox you can use the ScrollIntoView method of the control. You would need to just pass the index of the desired item (last index in your case) as shown below:

this.listBox.ScrollIntoView(this.listBox.Items.Count - 1);

Hope this helps.

Regards,
Kalin
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
ListBox
Asked by
ITA
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Share this question
or