Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.


1 Answers

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

FocusManager.FocusedElement="{Binding RelativeSource={RelativeSource Self}}"
like image 125
Jinesh Avatar answered Dec 15 '25 00:12

Jinesh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!