Jordan
Jordan

Reputation: 327

OnBackKeyPress override method

I want to use the back key to hide/disable a pop-up page on Windows phone and I am using the following code to do so.

protected override void OnBackKeyPress( System.ComponentModel.CancelEventArgs e )   
{              
   if (myPopupUp.IsOpen)
   {
    myPopUp.IsOpen = false;
    e.Cancel = true;   
   }

   base.OnBackKeyPress(e);
}

But when i run the application it gives an error that saying "no suitable method found to override" Does anyone know the solution for this? I welcome any ideas. Thank you.

Upvotes: 0

Views: 3119

Answers (2)

Milan Aggarwal
Milan Aggarwal

Reputation: 5104

It works for me in my panorama page, I hope you are not overriding this in any of your custom userControl.

    protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
    {
        e.Cancel = true;
        base.OnBackKeyPress(e);
    }

Upvotes: 1

Pedro Lamas
Pedro Lamas

Reputation: 7233

Try using the PhoneApplicationPage.BackKeyPress event instead.

Upvotes: 0

Related Questions