Skip to content

Commit d10640b

Browse files
authored
Merge pull request #693 from telerik/new-kb-treeview-capture-tab-keypress-kb-e009cbe78d1340d7b9d25591b0c44b2b
Added new kb article treeview-capture-tab-keypress-kb
2 parents d2e5643 + ef0cff1 commit d10640b

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
title: Capturing Tab Keypress in RadTreeView for WinForms
3+
description: Learn how to capture the Tab keypress event in RadTreeView for WinForms by overriding the IsInputKey method.
4+
type: how-to
5+
page_title: How to Capture Tab Key Press in RadTreeView for WinForms
6+
slug: capture-tab-keypress-radtreeview-winforms
7+
tags: radtreeview, winforms, keypress, tab, override, isinputkey
8+
res_type: kb
9+
ticketid: 1176748
10+
---
11+
12+
## Description
13+
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.
14+
15+
## Environment
16+
17+
|Product Version|Product|Author|
18+
|----|----|----|
19+
|2025.1.211|RadTreeView for WinForms|[Dinko Krastev](https://www.telerik.com/blogs/author/dinko-krastev)|
20+
21+
## Solution
22+
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.
23+
24+
Here is an example of how to implement this:
25+
26+
````C#
27+
class MyTreeView : RadTreeView
28+
{
29+
public override string ThemeClassName
30+
{
31+
get { return typeof(RadTreeView).FullName; }
32+
}
33+
protected override bool IsInputKey(Keys keyData)
34+
{
35+
if (keyData == Keys.Tab)
36+
{
37+
// Perform specific action
38+
return true;
39+
}
40+
41+
return base.IsInputKey(keyData);
42+
}
43+
}
44+
````
45+
46+
This solution is valid for controls that do not have explicit handling of the Tab key internally and for standard .NET controls as well.
47+
48+
## See Also
49+
- [RadTreeView Overview](https://docs.telerik.com/devtools/winforms/controls/treeview/overview)

0 commit comments

Comments
 (0)