Luan Pham
Luan Pham

Reputation: 187

How to press TAB key to select first row in Datagrid WPF

I have a form with 2 controls is textbox and datagrid.
Firstly I focus on textbox, and I want only pressing Tab Key 1 times to select first row. 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.

enter image description here

How can I press TAB key at the first time then the first row is seleted. NOT the cell selected?

Upvotes: 1

Views: 303

Answers (1)

Kuba Do
Kuba Do

Reputation: 155

You can try to set SelectionMode to FullRowSelect

in Form.Designer.cs :

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

or in properties of datagridview

Upvotes: 1

Related Questions