Processing of Windows 10 backend buttons and Windows 10 backend buttons
More than a year ago, I wrote a 8.0 Course table for our school. Now I want to migrate it to Windows 10 and support both PC and mobile phones.
Everything was normal, but something went wrong when handling the rollback button.
In the Channel9 10166 video, Microsoft provided how to handle the mobile phone rollback button.
Is to add extension to the mobile phone in the project
Use this line of code to make a judgment at runtime
If (Windows. foundation. metadata. apiInformation. isTypePresent ("Windows. phone. UI. input. hardwareButtons ") {Windows. phone. UI. input. hardwareButtons. backPressed + = HardwareButtons_BackPressed ;}
I used this method at the beginning, but I found that this method has limitations, that is, it does not support the rollback button in the tablet mode of PC.
So how can we support both?
After some searches, we found that it is easy to write this article if you want to support it at the same time !!!
Var view = SystemNavigationManager. GetForCurrentView (); view. BackRequested + = View_BackRequested;
In addition, there is no need to add a reference to the extension of the mobile phone!
This event is a routing event. If you do not want to pass it to the upper layer, you must mark it
E. Handled = true;
Good luck! The rollback button is perfectly handled!