DIsable HardwareButton on Windows Phone 8.1

I have a basic application on Windows Phone 8.1, and in it I have the usual buttons for navigating or exiting the application. I want to disable HardwareButton for return / exit, so if someone clicks it, the application will not exit. Any help?

Btw, I tried:

Public void HardwareButtons_BackPressed(object sender, Windows.Phone.UI.Input.BackPressedEventArgs e) { e.Handled = false; } 
+6
source share
1 answer

You must rewrite the HardwareButtons_BackPressed method in the App.xaml.cs file.

Also, if you handled an event, you need to set e.Handled = true to tell the system with which you already handled the event, and do not click the event below in the queue.

See MSDN for more details and examples.

+3
source

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


All Articles