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

Scroll position

4 Answers 293 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Test
Top achievements
Rank 1
Test asked on 06 May 2015, 01:01 PM

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

Sort by
0
Accepted
Nasko
Telerik team
answered on 08 May 2015, 11:46 AM
Hi Tomas,

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)
{
      varscrollViewerCombo = 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.

 
0
Test
Top achievements
Rank 1
answered on 13 May 2015, 09:29 AM

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

0
David
Top achievements
Rank 1
answered on 19 Mar 2019, 12:11 PM

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?

0
Martin Ivanov
Telerik team
answered on 21 Mar 2019, 02:26 PM
Hi David,

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
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
ComboBox
Asked by
Test
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Test
Top achievements
Rank 1
David
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or