Skip to content

Commit a8ad75b

Browse files
How to suspend the PING sound when perform the Tab operation in DataGrid(SfDataGrid)?
How to suspend the PING sound when perform the Tab operation in DataGrid(SfDataGrid)?
1 parent 2c848bf commit a8ad75b

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

README.md

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,35 @@
1-
# How-to-suspend-the-PING-sound-when-perform-the-Tab-operation-in-DataGrid-SfDataGrid-
2-
How to suspend the PING sound when perform the Tab operation in DataGrid(SfDataGrid)?
1+
# How to suspend the PING sound when perform the Tab operation in DataGrid(SfDataGrid)?
2+
3+
## About the sample
4+
5+
This example illustrates how to suspend the PING sound when perform the Tab operation in DataGrid(SfDataGrid)?
6+
7+
SfDataGrid doesn’t have direct support to disable this sound, which occurs when pressing Tab key on the TextBox. It is the behavior of the default TextBox. However, you can disable this by enabling the SuppressKeyPress property within the KeyDown event of the TextBox. In SfDataGrid cells this can be achieved by creating custom renderer.
8+
9+
```C#
10+
this.sfDataGrid.CellRenderers["TextBox"] = new GridTextBoxCellRendererExt();
11+
12+
class GridTextBoxCellRendererExt : GridTextBoxCellRenderer
13+
{
14+
protected override void OnInitializeEditElement(DataColumnBase column, Syncfusion.WinForms.GridCommon.ScrollAxis.RowColumnIndex rowColumnIndex, TextBox uiElement)
15+
{
16+
base.OnInitializeEditElement(column, rowColumnIndex, uiElement);
17+
uiElement.KeyDown += uiElement_KeyDown;
18+
}
19+
20+
protected override void OnUnwireEditUIElement(TextBox uiElement)
21+
{
22+
base.OnUnwireEditUIElement(uiElement);
23+
uiElement.KeyDown -= uiElement_KeyDown;
24+
}
25+
26+
void uiElement_KeyDown(object sender, KeyEventArgs e)
27+
{
28+
if (e.KeyCode == Keys.Tab)
29+
e.SuppressKeyPress = true;
30+
}
31+
}
32+
```
33+
34+
### Requirements to run the demo
35+
Visual Studio 2015 and above versions

0 commit comments

Comments
 (0)