Hi.
When I open a combobox, selected item is scrolled somewhere in the bottom of dropdown area (Screenshot 1). I need to have selected item scrolled at the very top of that area (Screenshot 2). Is this possible? How can I do that?
Thank you.
Tomas
4 Answers, 1 is accepted
What we could suggest you in order to achieve the desired behavior of RadComboBox's ScrollViewer is to get the control from the Template of the ComboBox control and scroll to the desired position as shown below:
private
void
radComboBox_Loaded(
object
sender, RoutedEventArgs e)
{
var
scrollViewerCombo =
this
.radComboBox.Template.FindName(
"PART_ScrollViewer"
,
this
.radComboBox)
as
ScrollViewer;
//use the Scroll methods to scroll to the desired position
}
Hopes this helps.
Regards,
Nasko
Telerik
See What's Next in App Development. Register for TelerikNEXT.
Thanks Nasko.
Good idea. I just had to handle DropDownOpened event instead of Loaded, because I need to scroll selected item to the top everytime drop down is opened. Seems it works fine now.
Regards,
Tomas
I can reply to this thread and still get an answer. I am having the same issue and cannot get this to work at all. I tried using all of the scroll methods as suggested and none of them to do anything. I also always want the selected item to be at the top the bottom. So if the combo is opened on focus and I have a list of all different cars. If I type the letter R, I would like the first Red Car to position at the top. It makes much more sense then positioning at the bottom. If I typed an R, why would I want to see all the items that come before R? It does not make sense. Is there a way to force the WPF combo to work this way?
Attaching my project and posting the reply also here. Hopefully, this will be useful for someone else also.
"Can you try the approach shown in the attached project and let me know if it helps? Basically, I am creating a custom filtering behavior on overriding its FindMatchingIndexes() method. In the method, I am getting the 6th item after the found one and bringing it into view. This way, the actually found item goes on top of the list. "
Regards,
Martin Ivanov
Progress Telerik