user3405024
user3405024

Reputation:

Get focus on a textbox inside a gridview

I have created a WPF page with a GridView. In that GridView there are 5 TextBoxes available per row. When I enter the data on the first TextBox in the first row and then press tab, the focus moves onto the next TextBox. I enter the data on that TextBox and press tab and so on.... Finally I enter the data on the last TextBox on that row and press the enter key. The focus moves to elements outside the GridView.

I want the focus to move onto the first TextBox of the second row of the GridView.

Upvotes: 3

Views: 867

Answers (1)

JINESH
JINESH

Reputation: 1452

Try this on the text box you want to focus..

FocusManager.FocusedElement="{Binding RelativeSource={RelativeSource Self}}"

Upvotes: 8

Related Questions