Search code examples
c#wpf

c# wpf how to set the cursor in WPF textbox like tabindex in windows form?


I want to get the cursor in the WPF TextBox. so user does not click in the text box before typing like tabindex in windows form thanks for helping


Solution

  • If you want to set the focus manually, you should just set the focus like this:

    textBox.Focus();
    

    You need to give the TextBox the name "textBox" for this. It is not an MVVM way, but should do the trick...