Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DIsable HardwareButton on Windows Phone 8.1

I have some basic app on windows phone 8.1, and in that i have regular buttons, for navigate or exit application. I want to disable HardwareButton for back/exit, so if anyone press it, application will not exit. Any help?

Btw, i tried:

Public void HardwareButtons_BackPressed(object sender, Windows.Phone.UI.Input.BackPressedEventArgs e)
{
    e.Handled = false;     

} 
like image 321
Bojan Zloporubovic Avatar asked May 15 '15 08:05

Bojan Zloporubovic


1 Answers

You have to rewrite the HardwareButtons_BackPressed method on App.xaml.cs file.

Also if you have handled the Event, you have to set e.Handled = true to tell the system you have already handled the event and dont push the event below in the queue.

For more and examples see MSDN.

like image 195
take Avatar answered Sep 25 '22 19:09

take