Keyboard Support
The article describes the Keyboard Support feature of RadNavigationView.
Keyboard Shortcuts
This section describes the keyboard shortcuts supported by RadNavigationView.
Escape: Closes the Navigation Pane.
Up: Highlights the previous RadNavigationViewItem.
Down: Highlights the next RadNavigationViewItem.
Left: Highlights the previous RadNavigationViewItem. If the currently highlighted item has children and it is expanded, it will collapse it.
Right: Highlights the next RadNavigationViewItem. If the currently highlighted item has children and it is collapsed, it will expand it.
PageUp: Highlights the 10th item previous to the currently highlighted item or the first item if there are less than 10.
PageDown: Highlights the 10th item after the currently highlighted item or the last item if there are less than 10.
Enter: Selects the currently highlighted item.
Home: Highlights the first RadNavigationViewItem.
End: Highlights the last RadNavigationViewItem.
F4: Opens/Closes the NavigationPane.
Customize Shortcuts
In order to customize the behavior for a given shortcut or introduce custom behavior, the HandleKeyDown virtual method can be overriden. Example 1 demonstrates how this can be done in order to prevent the closing of the Navigation Pane when the Escape key is hit.
Example 1: Overriding the RadNavigationView behavior for the Escape key
public class CustomNavigationView : RadNavigationView
{
protected override bool HandleKeyDown(Key key)
{
if(key == Key.Escape)
{
return false;
}
return base.HandleKeyDown(key);
}
}
Public Class CustomNavigationView
Inherits RadNavigationView
Protected Overrides Function HandleKeyDown(ByVal key As Key) As Boolean
If key Is Key.Escape Then
Return False
End If
Return MyBase.HandleKeyDown(key)
End Function
End Class
Keyboard Navigation Selection
By default, when the user is navigating through the RadNavigationViewItems with the keyboard, they are only highlighted, but not selected. However, you can change this behavior by setting the CanKeyboardNavigationSelectItems property of the RadNavigationView to True. This way the RadNavigationViewItems will be selected when navigating through them.
Example 1: Setting the CanKeyboardNavigationSelectItems property
<telerik:RadNavigationView CanKeyboardNavigationSelectItems="True" />