Keyboard Support

Using the keyboard you can perform some of the most common tasks.

Keyboard Shortcuts

This section describes the keyboard shortcuts used by RadAutoCompleteBox.

  • Up: Navigates up through the items in the DropDown portion of the control.

  • Down: Navigates down through the items in the DropDown portion of the control.

  • Tab: Selects the highlighted item and loses the focus. If there is no suggested item just loses the focus.

  • Enter: Closes the DropDown if it is open and selects the currently highlighted item.

  • Escape: Closes the DropDown and deletes the last entered text which has not been autocompleted.

When an item is selected with the keyboard, it should be scrolled into the viewport and made visible.

Customize Shortcuts

As of R2 2016 SP1 the HandleKeyDown method can be overridden in order to customize the keys' default behavior or handle other keys. The method returns True if the KeyDown event should be handled, and False otherwise.

A possible scenario would be to select the highlighted item and move the focus to the next control once the user presses Tab. Example 1 demonstrates how this can be achieved.

Example 1: Overriding the HandleKeyDown method

public class CustomAutoCompleteBox : RadAutoCompleteBox 
    protected override bool HandleKeyDown(Key systemKey) 
        if (systemKey == Key.Tab) 
            return false; 
        return base.HandleKeyDown(systemKey); 
Public Class CustomAutoCompleteBox 
Inherits RadAutoCompleteBox 
    Protected Overrides Function HandleKeyDown(ByVal systemKey As Key) As Boolean 
        If systemKey Is Key.Tab Then 
            Return False 
        End If 
        Return MyBase.HandleKeyDown(systemKey) 
    End Function 
End Class 

Tab Navigation

TabNavigationExtensions.IsTabStop attached property indicates whether RadAutoCompleteBox is included in the tab navigation cycle. Example 1 illustrates how to set that property in order to exclude the control from the tab navigation. The property is available since R3 2016.

Example 2: RadAutoCompleteBox with TabNavigationExtensions.IsTabStop

<telerik:RadAutoCompleteBox telerik:TabNavigationExtensions.IsTabStop="False" /> 

See Also

In this article
Not finding the help you need? Improve this article