New to Telerik UI for WPF? Download free 30-day trial

How to Scroll Multiple Items with Page Up and Down

Environment

Product Version 2020.3.817
Product RadAutoCompleteBox for WPF

Description

How to enable the scrolling of multiple items using the Page Up and Page Down keys.

Solution

As of version 2020.3.817 the RadAutoCompleteBox exposes a protected HighlightedIndex property which can be used to set the highlighted item. This property can be used in the HandleKeyDown method of the control to enable custom keyboard navigation with the Page Up and Page Down keys.

public class CustomAutoCompleteBox : RadAutoCompleteBox 
{ 
    protected override bool HandleKeyDown(Key systemKey) 
    { 
        if (systemKey == Key.PageDown) 
        { 
            this.HighlightedIndex += 10; 
            return true; 
        } 
 
        if (systemKey == Key.PageUp) 
        { 
            this.HighlightedIndex -= 10; 
            return true; 
        } 
 
        return base.HandleKeyDown(systemKey); 
    } 
} 

See Also

In this article