This question is locked. New answers and comments are not allowed.
Hello,
When selected Index change, I want to scroll automaticly on selected index.
So when selection change I call ScrollIntoView. With a ListBox it's work perfectly but with RadListbox it's doesn't work.
Any idea to fix it?
Thank by advance.
When selected Index change, I want to scroll automaticly on selected index.
So when selection change I call ScrollIntoView. With a ListBox it's work perfectly but with RadListbox it's doesn't work.
void
ListBoxSelectionChanged(
object
sender, Telerik.Windows.Controls.SelectionChangedEventArgs e)
{
if
(SelectedItem !=
null
)
ScrollIntoView(SelectedIndex);
}
Any idea to fix it?
Thank by advance.
4 Answers, 1 is accepted
0
Hi Jérôme,
We tried to reproduce the issue but with no success. Can you confirm that you are using the latest Q2 release version?
If you still experience the issue, please open a support ticket and send us sample project demonstrating the issue there.
Greetings,
Vladi
the Telerik team
We tried to reproduce the issue but with no success. Can you confirm that you are using the latest Q2 release version?
If you still experience the issue, please open a support ticket and send us sample project demonstrating the issue there.
Greetings,
Vladi
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Mike Krik
Top achievements
Rank 1
answered on 25 Jul 2012, 02:22 PM
I have the exact same problem, here is a sample project with a listbox containing a list of countries, I set the SelectedItem to United Kingdom and even though the selection is made correctly, you have to scroll down in order to see the selected item in the listbox even though i set the ScrollIntoView on SelectionChanged:
Any ideas what i'm doing wrong?
Thanks in advance.
Mike
private
void
lbCountries_SelectionChanged(
object
sender, SelectionChangedEventArgs e)
{
if
(lbCountries.SelectedItem !=
null
)
{
lbCountries.ScrollIntoView(lbCountries.SelectedIndex);
}
}
Any ideas what i'm doing wrong?
Thanks in advance.
Mike
0
Hi Mike,
The issue you are having is that the SelectionChanged event is triggered before the ListBox control is loaded. The ListBox needs to be loaded first In order the ScrollIntoView method to work. All you need to do to fix the problem is to execute the logic you have in the SelectionChanged event handler from withing the Loaded event handler of the ListBox control. This way RadListBox control will be loaded when you need to call ScrollIntoView.
I have edited and attached your project for you. You can find it attached to this post.
Kind regards,
Vladi
the Telerik team
The issue you are having is that the SelectionChanged event is triggered before the ListBox control is loaded. The ListBox needs to be loaded first In order the ScrollIntoView method to work. All you need to do to fix the problem is to execute the logic you have in the SelectionChanged event handler from withing the Loaded event handler of the ListBox control. This way RadListBox control will be loaded when you need to call ScrollIntoView.
I have edited and attached your project for you. You can find it attached to this post.
Kind regards,
Vladi
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Mike Krik
Top achievements
Rank 1
answered on 16 Aug 2012, 06:53 PM
Thank you Vladi that solved my problem.
Cheers,
Mike
Cheers,
Mike