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

Capturing Tab Keypress in RadTreeView for WinForms

Description

When a node is selected in the RadTreeView control and the Tab key is pressed, it doesn't seem to fire any of the keypress style events (down/press/up). This knowledge base article demonstrates how to capture the Tab keypress in the RadTreeView for WinForms.

Environment

Product Version Product Author
2025.1.211 RadTreeView for WinForms Dinko Krastev

Solution

To handle the Tab keypress in RadTreeView, create a custom class that inherits from RadTreeView and override the IsInputKey method. This method checks if the pressed key is the Tab key and allows you to perform a specific action if it is.

Here is an example of how to implement this:

class MyTreeView : RadTreeView
{
    public override string ThemeClassName
    {
        get { return typeof(RadTreeView).FullName; }
    }
    protected override bool IsInputKey(Keys keyData)
    {
        if (keyData == Keys.Tab)
        {
            // Perform specific action
            return true;
        }

        return base.IsInputKey(keyData);
    }
}

This solution is valid for controls that do not have explicit handling of the Tab key internally and for standard .NET controls as well.

See Also

In this article