Is there a way to programatically reset the position of the thumb in the vertical scrollbar to the top? Example: the user pulls down the ComboBox's list and scrolls down to the bottom, then selects the bottom item. After the list has been repopulated with a different set of items, I would like to have the thumb be back at the top of the list when the user reopens the ComboBox. Currently, the position of the thumb does not get reset when the ComboBox's list is repopulated. It remains at the same position it was at when the ComboBox closed, even when the items have been replaced.
6 Answers, 1 is accepted
0
Hi Frank,
There is no way to reset the scrollbar position. If you have a selected item, however, the scroll position should automatically change so that the selected item is visible every time you open the dropdown.
Best wishes,
Valeri Hristov
the Telerik team
There is no way to reset the scrollbar position. If you have a selected item, however, the scroll position should automatically change so that the selected item is visible every time you open the dropdown.
Best wishes,
Valeri Hristov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Frank
Top achievements
Rank 1
answered on 21 Sep 2011, 07:09 PM
Ok, I see, thanks for the information Valeri.
0
Daniel
Top achievements
Rank 1
answered on 23 Jan 2013, 06:59 PM
I know this is a REALLY old thread to be posting to. But this is one of the first google search results for "silverlight radcombobox scroll to top" So i thought i'd post for anyone else having this problem.
There is a workaround for resetting the scrollbar position in a RadComboBox. You just need to get the ScrollViewer from the template and scroll it to the top.
If you're extending the RadComboBox, here's the code for it:
If you're not extending the RadComboBox, you should be able to modify the code to fit your needs easily
There is a workaround for resetting the scrollbar position in a RadComboBox. You just need to get the ScrollViewer from the template and scroll it to the top.
If you're extending the RadComboBox, here's the code for it:
public
void
ScrollToTop()
{
var scrollViewer = GetTemplateChild(
"PART_ScrollViewer"
)
as
ScrollViewer;
if
(scrollViewer !=
null
)
{
scrollViewer.ScrollToVerticalOffset(0);
}
}
If you're not extending the RadComboBox, you should be able to modify the code to fit your needs easily
0
Prashant
Top achievements
Rank 1
answered on 02 Sep 2013, 12:10 PM
Is there anyway to programatically reset the position of the thumb in the vertical scrollbar to the top? Example: the user pulls down the ComboBox's list and scrolls down to the bottom, then selects the bottom item. After the list has been repopulated with a different set of items, I would like to have the thumb be back at the top of the list when the user reopens the ComboBox. Currently, the position of the thumb does not get reset when the ComboBox's list is repopulated. It remains at the same position it was at when the ComboBox closed, even when the items have been replaced.
Thanks in advance for the help .
Thanks in advance for the help .
0
Hello Prashant,
There isn't built-in functionality in the ComboBox that allows you to reset the scrollbar position. However as an easy work-around I can suggest that in the method where you are inserting the new ComboBox items you could set the ComboBox SelectedItem to the first item of the collection in order to move the scrollbar up to the top. And if don't want any item to be selected you would just need to set the SelectedItem to null after that. Please see the code snippet below:
Hope this will help you.
Regards,
Kalin
Telerik
There isn't built-in functionality in the ComboBox that allows you to reset the scrollbar position. However as an easy work-around I can suggest that in the method where you are inserting the new ComboBox items you could set the ComboBox SelectedItem to the first item of the collection in order to move the scrollbar up to the top. And if don't want any item to be selected you would just need to set the SelectedItem to null after that. Please see the code snippet below:
comboBox.SelectedItem = comboBox.Items[0];
comboBox.SelectedItem =
null
;
Hope this will help you.
Regards,
Kalin
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
danparker276
Top achievements
Rank 2
answered on 20 Dec 2013, 07:30 PM
This only seems to work if I make the drop down visible
comboBox.IsDropDownOpen = true;
Then it looks funny, cus it opens and closes.
Sorry, suggest code works, but I have to put it in the DropDownOpened event.
comboBox.IsDropDownOpen = true;
comboBox.SelectedItem = comboBox.Items[0];
comboBox.SelectedItem =
null
;
comboBox.IsDropDownOpen = false;
Then it looks funny, cus it opens and closes.
Sorry, suggest code works, but I have to put it in the DropDownOpened event.