Try going back a few steps... when I copied your code into a new project and added a couple of TextBoxes
, it already does what you are after. The MessageBox
popped up, I clicked OK
and focus stayed in textBox1
. This is the behaviour that I expected.
I suggest to you that it is your code elsewhere that is moving the logical focus to textBox2
, maybe even a property that you set on the Window
or UserControl
that the TextBox
es reside in.