Mikhail Denisov
Mikhail Denisov

Reputation: 77

How to handle OnBackKeyPress when keyboard is open

I'm trying to override back key button

protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)

But it can't be handled until screen keyboard is open. Is any way to do this?

Upvotes: 0

Views: 45

Answers (1)

Eldar Dordzhiev
Eldar Dordzhiev

Reputation: 5135

Try handling KeyUp event in your page and check the key code in its handler. This method was working on Silverlight with SIP opened, I'm pretty sure it will work on WinRT too.

void KeyUpHandler(object sender, KeyRoutedEventArgs e)
{
    if (e.Key == Windows.System.VirtualKey.Back)
    {
        // The back button has been clicked
    }
}

Upvotes: 1

Related Questions