Scroll position

5 posts, 1 answers
  1. Test
    Test avatar
    2 posts
    Member since:
    May 2015

    Posted 06 May 2015 Link to this post

    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

  2. Answer
    Nasko
    Admin
    Nasko avatar
    726 posts

    Posted 08 May 2015 Link to this post

    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.

     
  3. Test
    Test avatar
    2 posts
    Member since:
    May 2015

    Posted 13 May 2015 in reply to Nasko Link to this post

    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

  4. David
    David avatar
    9 posts
    Member since:
    Oct 2017

    Posted 19 Mar Link to this post

    Hopefully 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 seem to do anything.  I also always want the selected item to be at the top not the bottom.  So if the combo is opened on focus and I have a list of all different color 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?

  5. Martin Ivanov
    Admin
    Martin Ivanov avatar
    2135 posts

    Posted 21 Mar Link to this post

    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.
Back to Top