I have a simple screen with 2 TextBox elements and one Button . The Button event handler starts with the following lines:

  private async void ForgotButton_Click(object sender, RoutedEventArgs e) { (sender as Button).IsEnabled = false; 

The problem is that when you click on the button, the first TextBox automatically gets focus on itself, the on-screen keyboard pops up, the cursor flashes. I do not understand why this is happening, because I did not click on it.

By the method of " scientific spear " it was established that it is because of this line that the problem appears.


Here is a small demonstration of what is happening on the screen: enter image description here

    1 answer 1

    This happens because if an element is zadisable, then there can be no focus on it, so the system switches the focus to the next element in order - it is just textbox.

    Since in Vinfon there is no possibility to bypass the controls in the same way as pressing the Tab button, you can try both text boxes to set the IsTabStop=False property IsTabStop=False .

    • It really helped. - user200141
    • @ Oleg, well, great. - andreycha