How to pull down the GridComboBox in Tab key in WinForms DataGrid?
In WinForms DataGrid, drop down of GridComboBoxColumn will open when double clicking the cell. But, you can open the drop down by press the Tab key using a custom renderer can be derived from GridComboBoxCellRenderer. In the custom renderer, the OnKeyUp method can be overridden to show the dropdown.
public class GridComboBoxCellRendererExt : GridComboBoxCellRenderer { SfDataGrid dataGrid; SfComboBox SfCombo; public GridComboBoxCellRendererExt(SfDataGrid sfDataGrid) { dataGrid = sfDataGrid; } protected override void OnKeyUp(DataColumnBase dataColumn, RowColumnIndex rowColumnIndex, KeyEventArgs e) { if (e.KeyData == Keys.Tab) { dataGrid.CurrentCell.BeginEdit(); //To open the dropdown SfCombo.ShowDropDown(); } } }
//To add custom ComboBox renderer to DataGrid this.sfDataGrid.CellRenderers.Remove("ComboBox"); this.sfDataGrid.CellRenderers.Add("ComboBox", new GridComboBoxCellRendererExt(sfDataGrid)); //To add a combo box column in grid. sfDataGrid.Columns.Add(new GridComboBoxColumn() { MappingName = "ShipCityID", HeaderText = "Ship City", ValueMember = "ShipCityID", DisplayMember = "ShipCityName", IDataSourceSelector = new CustomSelector() });
Conclusion
I hope you enjoyed learning about how to modify the GridHyperLinkColumn text in WinForms DataGrid.
You can
refer to our WinForms DataGrid feature
tour page to know about its other groundbreaking feature
representations and documentation, and
how to quickly get started for configuration specifications. You can also
explore our WinForms
DataGrid
example to understand how to
create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!