简体   繁体   English

如何按TAB键选择Datagrid WPF中的第一行

[英]How to press TAB key to select first row in Datagrid WPF

I have a form with 2 controls is textbox and datagrid.我有一个带有 2 个控件的表单是文本框和数据网格。
Firstly I focus on textbox, and I want only pressing Tab Key 1 times to select first row.首先,我专注于文本框,我只想按 Tab 键 1 次来选择第一行。 But now when I press Tab Key at the first time it will focus first cell but row is not seleted, when I press Tab Key at the second time first row is seleted, see the picture.但是现在当我第一次按下 Tab 键时,它会聚焦第一个单元格但没有选择行,当我第二次按下 Tab 键时,第一行被选中,见图。

在此处输入图片说明

How can I press TAB key at the first time then the first row is seleted.如何在第一次按下 TAB 键然后选择第一行。 NOT the cell selected?不是选定的单元格?

You can try to set SelectionMode to FullRowSelect您可以尝试将 SelectionMode 设置为 FullRowSelect

in Form.Designer.cs :在 Form.Designer.cs 中:

   this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;

or in properties of datagridview或在 datagridview 的属性中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM