Search code examples
c#wpftextboxfocus

WPF always focus on a textbox


I want to always Focus on a specific TextBox on my WPF application whenever I click on anything on the application it should always focus on the TextBox.


Solution

  • There is an event handler MouseLeftMouseButton. When the event handler was triggered, use textbox.Focus() inside the handler.