How to make the back button back when you see the on-screen keyboard?

I have a simple input form consisting of a single text box and OK / Cancel buttons. To save custom taps, I bring focus to the text box when the page is displayed, so the keyboard appears. At this point, I want the back button to behave the same way as undoing and moving backward if it is pressed, but what the thing really does is it just removes the focus from the text box without even starting the BackKeyPress event. The next time it is pressed, it moves back, but these are two clicks instead of one.

So I have two questions

  • How to make the back button "return" even when the keyboard is visible?
  • Am I trying to do something bad in terms of WP7 interoperability design?
+3
source share
2 answers

What you can do is handle the KeyUp method for the text field. When a key is pressed, check if it is a hardware back key. In my test, the hardware back key has PlatformKeyCodeout of 27. I'm not sure if this happens between hardware devices. However, assuming this is not the case, you can do the following:

    private void TextBox_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
    {
        if(e.PlatformKeyCode == 27)
        {
           //Navigation code
        }

    }

, . . , , . , SIP , , , . " " , , - .

+2

, OnBackKeyPressed?

, "" , :

5.2.4 ""

, "" .

. "" .

. "" .

. , "" .

. , "" , . ""

SO ....

P, , SIP , , :)

+1

Source: https://habr.com/ru/post/1766649/


All Articles