Keyboard Support

RadTabControl exposes several useful properties and events, which can help you to control the keyboard interaction and to get notified when a key is up or down.

Properties

Set the IsTabStop property to include/exclude the control in the tab navigation cycle. If this property is set to True, then the control will be included; if it is False it will be skipped.

  • The TabIndex property defines the index of the control in the tab navigation cycle. The lower the number, the earlier the control will be focused while navigating using the Tab key. If you set this property, do not forget to set IsTabStop to True. Once focused, you can navigate through the tab pages using the left and right arrow keys.

Events

  • KeyDown – get notified when the user has pressed a keyboard key.

  • KeyUp– get notified when the user has released a keyboard key.

To obtain the pressed key, the object that raised the event or some other information, use the instance of System.Windows.Input.KeyEventArgs passed as a parameter to the event handler method.

<telerik:RadTabControl x:Name="tabControl" KeyDown="tabControl_KeyDown" KeyUp="tabControl_KeyUp"> 
</telerik:RadTabControl> 

The implementation of both event handlers tabControl_KeyDown and tabControl_KeyUp is located in the code-behind file and looks like this:

private void tabControl_KeyDown( System.Object sender, System.Windows.Input.KeyEventArgs e) 
{ 
    MessageBox.Show("The pressed key is: " + e.Key.ToString()); 
} 
private void tabControl_KeyUp( System.Object sender, System.Windows.Input.KeyEventArgs e) 
{ 
    MessageBox.Show("The released key is: " + e.Key.ToString()); 
} 
Private Sub tabControl_KeyDown( ByVal sender As System.Object, ByVal e As System.Windows.Input.KeyEventArgs) 
    MessageBox.Show("The pressed key is: " + e.Key.ToString()) 
End Sub 
Private Sub tabControl_KeyUp( ByVal sender As System.Object, ByVal e As System.Windows.Input.KeyEventArgs) 
    MessageBox.Show("The released key is: " + e.Key.ToString()) 
End Sub 

See Also

In this article