UWP C# Keyboard input focus

VoyTec 671 Reputation points
2021-09-20T21:13:42+00:00

Greetings !!! :-)

Today's question:
How to return keyboard's input focus back to a TextBox which has been enabled again?

Universal Windows Platform (UWP)
{count} votes

Accepted answer
  1. Roy Li - MSFT 32,731 Reputation points Microsoft Vendor
    2021-09-21T02:39:10.487+00:00

    Hello,

    Welcome to Microsoft Q&A!

    Based on your scenario, you could just call the TextBox.Focus() Method to make the TextBox focus again. It's just a simple line of code and you could put it after you enable the TextBox.

    For example:

                MyTextBox.IsEnabled = true;  
                MyTextBox.Focus(FocusState.Programmatic);  
    

    Thank you.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful